Re: unit testing and not creating database for read only database

2010-07-29 Thread thusjanthan
Any suggestions?

On Jul 7, 2:21 pm, thusjanthan  wrote:
> Hi,
>
> So I have a read only database called "information" which has been
> modeled in the django framework with the managed=false for the META on
> all its tables. When I run unit tests on another app I do not want the
> unit tests to go and create a test database for "information" but
> would rather like to use the information's table's values to compute
> some other tests for this app. Is there any way to do that in django?
>
> Thusjanthan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



When doing select_related, the sql query produced is an INNER JOIN can that be changed to LEFT JOIN

2010-07-29 Thread thusjanthan
Hi,

I have the following relation:

class Email(models.Model):
id = models.CharField(max_length=15,primary_key=True)

...

class Person(models.Model):
id= models.CharField(max_length=15,primary_key=True)
email = models.ForeignKey(Email, db_column='id')


When I do: Person.objects.select_related().all()
The query that is run is:

SELECT id,email FROM Person INNER JOIN Email ON (Person.id =
Email.id)

As you can see if a person did not have an email address, this will
produce an empty list. Is there any way to force select_related to do
a LEFT JOIN so that even if email is null, the person is returned with
email set to null.

Cheers,
Thusjanthan.







-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Anyone want to take over maintaining Instant Django?

2010-07-13 Thread thusjanthan
Hi,

I wouldn't mind taking it on. I can host it on my hosting server and
maintain your child for you. Do let me know and we can exchange the
information.I am an eager new learner of django but am creating an
enterprise level application for a university at the moment and will
get up to speed rather fast.

Cheers,
Thusjanthan.

On Jul 13, 7:37 am, cjl  wrote:
> Djangoholics:
>
> I no longer have the time or interest to maintain my little project:
>
> http://www.instantdjango.com
>
> If anyone would like to take over the project, I would gladly give it
> away. Right now it costs a few dollars in shared hosting a month, and
> a few more dollars for the downloads I host with AWS. If you take over
> the project I will give you the domain, but I'm not going to pay the
> hosting.
>
> I'll also give you my 'build' script, but it no longer works correctly
> because the Python core devs broke the Windows installer, and mocked
> me when I reported the bug.
>
> The project website gets a hundred or so hits a day, and several
> thousand downloads a month. It also ranks highly for a few different
> google searches related to Django.
>
> Let me know if you have any interest. It wouldn't take much effort to
> maintain, I just can't do it anymore.
>
> -cjl

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: reportlab pdf creation: HTML textarea input formatting doesn't seem to work with Paragraph

2010-07-08 Thread thusjanthan
Basically what I am doing right now as a workaround is I wrote a
function to parse/wrap the value before printing it out. Anyone else
have a better solution please do let me know.

def preformat_html_textarea(value,endwidth=135):
''' since reportlab doesn't provide a way to keep the  of
what ever
is entered in the html textarea. This is manual way to text
wrap.
'''
import textwrap
new_value = value.replace('\r','')
new_values = new_value.split('\n')
result = ""
for line in new_values:
result += textwrap.fill(line,endwidth) + "\n"

return result


Thusjanthan


On Jul 8, 11:53 am, thusjanthan  wrote:
> Hi,
>
> I have a user that enters some formatted text in a html textarea. I
> would like to use reportlab to display that and other fields in a PDF.
> However when I wrap the text in a Paragraph type it alters the
> formatting. Can anyone suggest how to keep the formatting that the
> user enters into the textarea such as spaces and new lines etc.
>
> Example:
>
> objectives:
> Hi
>
> My name is blah etc..
>
> endcontent
>
> PythonCode:
>
> Story.append(Paragraph("%s" % objectives,styles['NormalIndent']))
>
> However the pdf outputs this as all clumped together like: "Hi My name
> is blah etc.. endcontent"
>
> Any thoughts?
>
> Cheers,
> Nathan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



reportlab pdf creation: HTML textarea input formatting doesn't seem to work with Paragraph

2010-07-08 Thread thusjanthan
Hi,

I have a user that enters some formatted text in a html textarea. I
would like to use reportlab to display that and other fields in a PDF.
However when I wrap the text in a Paragraph type it alters the
formatting. Can anyone suggest how to keep the formatting that the
user enters into the textarea such as spaces and new lines etc.

Example:

objectives:
Hi

My name is blah etc..


endcontent


PythonCode:

Story.append(Paragraph("%s" % objectives,styles['NormalIndent']))

However the pdf outputs this as all clumped together like: "Hi My name
is blah etc.. endcontent"

Any thoughts?

Cheers,
Nathan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



unit testing and not creating database for read only database

2010-07-07 Thread thusjanthan
Hi,

So I have a read only database called "information" which has been
modeled in the django framework with the managed=false for the META on
all its tables. When I run unit tests on another app I do not want the
unit tests to go and create a test database for "information" but
would rather like to use the information's table's values to compute
some other tests for this app. Is there any way to do that in django?

Thusjanthan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Is {% cycle ... as ... %} supposed to output a value?

2010-07-07 Thread thusjanthan
This is the desired behavior. Until the loop is done it cycles the
given values you provided in your case 'a' 'b' and since the loop is
running 3 times it cycles back to 'a' again.

Cheers,
Thusjanthan

On Jul 7, 8:55 am, ringemup  wrote:
> Er, that was sloppy of me.  Actual output:
>
> 
>   a
>   a
>   b
>   b
>   a
>   a
> 
>
> On Jul 7, 11:53 am, ringemup  wrote:
>
>
>
> > I thought that {% cycle 'a' 'b' as mycycle %} was supposed to just set
> > the variable {{ mycycle }} and not output anything to the template.
>
> > However, the following template (with myrange=[1, 2, 3]):
>
> > {* start template *}
> > 
> >   {% for i in myrange %}
> >     {% cycle 'a' 'b' as mycycle %}
> >     {{ mycycle }}
> >   {% endfor %}
> > 
> > {* end template *}
>
> > outputs:
>
> > 
> >   1
> >   1
> >   2
> >   2
> >   3
> >   3
> > 
>
> > Is this a bug or the desired behavior?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Override Django ORM with virtual model class - is it possible or no?

2010-07-06 Thread thusjanthan
Hi,

I am not sure if what your asking is possible as a field type in a
database is generally a single field. What you are trying to do is
have an object as a field type. Perhaps you can do a ForeignKey and
have a m2m relationship between the GenericModel? From what I remember
you can have custom field types but it can only be types from a
database. Don't quote me on that but I think so. Have a look at this
where they go further into custom model fields.

http://docs.djangoproject.com/en/dev/howto/custom-model-fields/#custom-database-types

Hope this helps,

Thusjanthan Kubendranathan.

On Jul 6, 11:43 am, test157  wrote:
> hello,
>
> I need one solution so hope you can help me, e.g. I have this model
>
> class GenericModel(models.Model):
>     val1 = models.CharField(max_length=50)
>     val2 = models.CharField(max_length=80)
>
> and I need to create many virtual models based on this one above, so
> it will looks this way:
>
> class Info(models.Model):
>     name = GenricModel.val1
>     address = GenericModel.val2
>
> class Details(models.Model):
>     size = GenricModel.val1
>     height = GenericModel.val2
>
> e.t.c.
>
> is it possible or no? so when I access Details or Info I have to work
> with GenericModel - so it's some kind of proxy, but with overrided
> field names.
>
> anyone knows how to do it in Django? or it's impossible?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to record/capture IP address of user/registrant in Django

2010-07-06 Thread thusjanthan
This would be done in the view that calls the registration page.
Suppose its like this

def index(request):
message = request.META['REMOTE_ADDR']
... send message ...

Basically short of it is the dictionary request.META contains the Key:
REMOTE_ADDR which contains the ip. You would access it as follows:
:

request.META['REMOTE_ADDR']

More information on the META dict can be found at:
http://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.META

Cheers,
Thusjanthan Kubendranathan

On Jul 6, 2:16 pm, NoviceSortOf  wrote:
> I would like to record the IP numbers of persons registering on our
> Django driven site. The IP can simply be recorded in the form
> generated and sent to us during the registration process, as we have
> custom notifiers sent to us whenever somebody registers. But I'm
> wondering in the registration process how we can capture the IP
> address of the user/registrant?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: HTML Frames and Django Template include

2010-07-06 Thread thusjanthan
Hi,

You can definitely have HTML frames. All you need to do is write a
base.html file that looks exactly the way you want statically and in
the part where you want your django apps to put content in you can do
the following in the base.html:


{% block content %}{% endblock %}


Suppose the div main is your right side of the frame.

Now the template file that gets called by your view you do the
following. Suppose the view calls test.html and you want it to be
wrapped by your theme you do the following in the test.html:

{% extends "base.html" %}

{% block content %}
Put the content of what you'd like on the right hand side using
context etc...
{% endblock %}

Now when you go to the test view you'll see the page wrapped by your
base.html with the content block in the right frame if you did it
correctly :)

Cheers,
Thusjanthan K




On Jul 6, 2:12 pm, NoviceSortOf  wrote:
> I would like to use html frames in Django but my initial experiements
> with it have not worked out.
>
> * Is there anyway to combine HTML frames into a Django
>   template {% include t?
>
> * I definitely need Django Context on the right side of the frame,
>   the left side is strictly navigational and of static content.
>
> * Is any of the above feasible with Django and if so what is the
>   best way to approach it in the template system?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: DATABASE_ROUTERS in settings.py results in Internal Server Error

2010-06-30 Thread thusjanthan
Hi,

If your project is named myproject and your app is named myapp where
the router is contained. Then you need to set it to the following and
you need to include the Classname as well. So if your AppRouter is
like this which is in the directory myproject.myapp:

AppRouter.py:
Class Router(object)


then your settings file should be as follows:

DATABASE_ROUTERS = ['myproject.myapp.AppRouter.Router']

Also it should display more than internal server error if you have
DEBUG set to True.

I hope this helps.

Cheers,
Nathan.



On Jun 30, 10:44 am, Michael  wrote:
> I tried to configure a database router according 
> tohttp://docs.djangoproject.com/en/dev/topics/db/multi-db/#an-example.
>
> All my attempts lead to the Django project outputing "Internal Server
> Error" generic message with no further info.
>
> If my project is named 'myproject' and my app named 'myapp' how should
> I configure the DATABASE_ROUTERS setting?
>
> I have a AppRouter.py in the folder: myproject/AppRouter.py
> The absolute path to AppRouter.py is: /home/username/webapps/django/
> myproject/AppRouter.py
>
> My settings.py has the line:
> DATABASE_ROUTERS = ['myproject.AppRouter',]
>
> But it doesn't work. How do I configure a 'python path' is it absolute
> or relative?
>
> Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



does QuerySet delete delete the objects by their primary key?

2010-06-30 Thread thusjanthan
Hi,

I did a query on an object using their "non" primary keys such that:

a = Topic.objects.filter(topic='Politics')
topic is not a primary key. suppose topicID is primary key.

When I run:

a.delete()

the SQL that is executed is:

DELETE FROM 'Topic' WHERE topicID in (1)



my problem is a little harder than that in the sense my table has
multiple keys so suppose its topicID and course is the primary key
together but since topicID is '1' for both the objects returned by the
filter it tries to be smart and randomly picks what it "thinks" is the
primary key and deletes based on that.

First off I hate the fact that Django doesn't support multiple primary
keys... Any suggestions to delete objects using their fields that are
passed in or do I have to override the delete function to be able to
do this?

Cheers,
Nathan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: More than one primary key for a model

2010-06-28 Thread thusjanthan
Yes you are correct I am looking to implement the compounded primary
keys. Well the problem is I would like to have a many to many(m2m)
with two models that share a compounded primary key. However when I do
the m2m join it randomly pics one of the compounded keys and tries to
join them? :| Does the unique_together parameter fix that problem? as
in does it use the unique_together to do the joins?



On Jun 28, 10:20 am, ringemup  wrote:
> By definition a database table can have only one primary key.  I
> believe what you're looking to implement are compound primary keys.
> Depending on the database backend you're using, the unique_together
> Meta attribute may accomplish most of what you're looking to do.
>
> On Jun 28, 12:49 pm, thusjanthan  wrote:
>
>
>
> > Can anyone tell me why django refuses to follow the rules and lesson
> > we learn in our database courses?
>
> > I have a table that I do not have control over. Suppose its called the
> > phone table and it contains the number and the username as the primary
> > key. But for some reason when I have more than one primary key in
> > django it complains. Especially when I run the test suite it just
> > craps out saying more than one primary key detected for a model. Does
> > django really expect all tables to only contain one primary key? How
> > can I override this feature and have it take more than one primary key
> > without using things suggested by django about the unique attr in the
> > meta info of the model.
>
> > Thanks.
> > Nathan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



More than one primary key for a model

2010-06-28 Thread thusjanthan
Can anyone tell me why django refuses to follow the rules and lesson
we learn in our database courses?

I have a table that I do not have control over. Suppose its called the
phone table and it contains the number and the username as the primary
key. But for some reason when I have more than one primary key in
django it complains. Especially when I run the test suite it just
craps out saying more than one primary key detected for a model. Does
django really expect all tables to only contain one primary key? How
can I override this feature and have it take more than one primary key
without using things suggested by django about the unique attr in the
meta info of the model.

Thanks.
Nathan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Creating and binding more than one model to a from

2010-06-28 Thread thusjanthan
Hi,

I have a Topic class I would like to create a form based on. BUT, I
want many of these objects so Topics. How do I obtain such a feature.

Suppose my form object is as follows:

class TopicForms(ModelForm):
class meta:
model = Topic
fields = ('topic_id','topic')

I want to display more than one of the topics that is associated to a
particular object. Suppose its a topic about obama and there are 10
topics. I want to display all 10 of these. and If they make a change
to one of them I would like to save that change on submission. I would
also like to provide additional blank topic fields for end users to
enter new topics about obama. Any help would be appreciated. I am a
little confused on the forms area of django.

Nathan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



manytomany relationships based on primary keys

2010-06-25 Thread thusjanthan
I have the following relationship between student and course:

class Student(models.Model):
crse_id = models.CharField(max_length=18,primary_key=True)
crse_offer_nbr = models.IntegerField(primary_key=True)
strm = models.CharField(max_length=12,primary_key=True)
class_section = models.CharField(max_length=12,primary_key=True)
student = models.CharField(max_length=15)

class Meta:
db_table = u'class_stdnts'

class Course(models.Model):
crse_id = models.CharField(max_length=18, primary_key=True)
crse_offer_nbr = models.IntegerField(primary_key=True)
strm = models.CharField(max_length=12, primary_key=True)
class_section = models.CharField(max_length=12, primary_key=True)

   #many to many fields
students = models.ManyToManyField(Student)

class Meta:
db_table = u'class_tbl'

When I do a query to get all the students such as follows:


>>> course = sims.Course.objects.filter(...)
>>> for c in course:
... for s in c.students.all():
... print s.student

I get the following error:

DatabaseError: (1146, "Table 'class_tbl_students' doesn't exist")

I figure doing a manytomany join will automatically join based on the
primary keys but when I also look at the query its running its doing
something like this:

Query:
SELECT `class_stdnts`.`crse_id`, `class_stdnts`.`strm`,
`class_stdnts`.`class_section`, `class_stdnts`.`student` FROM
`class_stdnts` INNER JOIN `class_tbl_students` ON
(`class_stdnts`.`crse_offer_nbr` = `class_tbl_students`.`student_id`)
WHERE `class_tbl_students`.`course_id` = 1


Any Thoughts?
Nathan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django csrf

2010-06-25 Thread thusjanthan
The quick answer is you have to put the following in your template
right after the  declaration:

 {% csrf_token %}

Cheers,
Nathan.


On Jun 25, 2:48 am, Li Hui  wrote:
> When I add enctype="text/plain" to a post form like  method="post" enctype="text/plain">, there is a "CSRF verification
> failed." error.
> But when I remove it, all is right.
> Who can tell me why?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to do select from table where something in ('What','When','Where')

2010-06-24 Thread thusjanthan
nvm found it :) just append it to the .exclude method right?

On Jun 24, 1:40 pm, thusjanthan  wrote:
> Hi,
>
> How about not in?
>
> Select * from tableA where columnA not in
> ('Value1','Value2','Value3')
>
> On Jun 24, 1:23 pm, Peter Herndon  wrote:
>
>
>
> > tableA.objects.filter(columnA__in=['Value1', 'Value2', 'Value3'])
>
> >http://docs.djangoproject.com/en/1.2/ref/models/querysets/#in
>
> > On Jun 24, 2010, at 4:18 PM, thusjanthan wrote:
>
> > > Hi,
>
> > > Can someone provide the syntax for doing the following in django
> > > queries:
>
> > > Select * from tableA where columnA in ('Value1','Value2','Value3')
>
> > > Cheers,
> > > nathan.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to do select from table where something in ('What','When','Where')

2010-06-24 Thread thusjanthan
Hi,

How about not in?

Select * from tableA where columnA not in
('Value1','Value2','Value3')


On Jun 24, 1:23 pm, Peter Herndon  wrote:
> tableA.objects.filter(columnA__in=['Value1', 'Value2', 'Value3'])
>
> http://docs.djangoproject.com/en/1.2/ref/models/querysets/#in
>
> On Jun 24, 2010, at 4:18 PM, thusjanthan wrote:
>
>
>
> > Hi,
>
> > Can someone provide the syntax for doing the following in django
> > queries:
>
> > Select * from tableA where columnA in ('Value1','Value2','Value3')
>
> > Cheers,
> > nathan.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to do select from table where something in ('What','When','Where')

2010-06-24 Thread thusjanthan
Hi,

Can someone provide the syntax for doing the following in django
queries:

Select * from tableA where columnA in ('Value1','Value2','Value3')

Cheers,
nathan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Would like to modify request.user and have it be the changed value through out site

2010-06-23 Thread thusjanthan
Hi,

Basically within my application for whatever reason I am changing the
user and doing something like this:

Ex: at first the request.user = UserA

request.user = Users.objects.get(some exp)

After this the request.user = UserB

However once the page redirects to another page the request.user goes
back to being the original one (UserA) that logged in. How do I
permanently change the request.user for the duration of the session?

Thank you all,
Nathan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



from a template how to access the request object

2010-06-23 Thread thusjanthan
Hi all.

>From a template suppose base.html in your templates how do I access
the request object without actually passing it via the view. Cause I
can access the user object using {{ user }} but I can't access the
get_full_path using something like {{ request.get_full_path }}

Any thoughts?

Nathan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django logging

2010-06-23 Thread thusjanthan
Hi,

I am creating a new django framework and figured django would come
with its own logging feature. I found this one that Fraser wrote but
is no longer in development (http://code.google.com/p/django-logging/
wiki/Overview) Can anyone suggest me a django logging project to log
debug/error messages at server level and as a bonus feature perhaps an
email to admin if a critical error happens.

Cheers,
Nathan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to create the model in a different database from within the same database server.

2010-06-16 Thread thusjanthan
Django 1.2

I have the following setup:

ProjectA
   settings.py:
...
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'test_database',  # Or path to
database file if using sqlite3.
'USER': 'user',  # Not used with sqlite3.
'PASSWORD': 'password',  # Not used with
sqlite3.
'HOST': '127.0.0.1',  # Set to empty
string for localhost. Not used with sqlite3.
'PORT': '3306',  # Set to empty string for
default. Not used with sqlite3.
}
}
...

now in the mysql database server the following databases exist:
test_database
Books
People


Under ProjectA director the following applications exist:
Books
People

What I would like to do is create the models within those applications
(Books/People) to write their sql tables to the appropriate database
within my one mysql database server.

eg: I want the create table on Books to be:
create table Books.author ...

Any thoughts?

On Jun 16, 12:40 pm, Nick  wrote:
> Which version of django are you working with?
>
> On Jun 16, 2:28 pm, thusjanthan  wrote:
>
>
>
> > Hi,
>
> > when I mean database I mean the separate databases from within one
> > mysql database server. So ex:
>
> > DB server: server.example.com
> > Databases that are contained in the one instance of mysql:
> > People
> > Books
>
> > I have made the connection in the settings.py at the project level but
> > in the individual applications suppose People I would like to create
> > the models that write the tables in that database space and the
> > application Books to write its models in the Books database. This
> > should be possible to do but not sure why its not working.
>
> > Any thoughts?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to create the model in a different database from within the same database server.

2010-06-16 Thread thusjanthan
Hi,

when I mean database I mean the separate databases from within one
mysql database server. So ex:

DB server: server.example.com
Databases that are contained in the one instance of mysql:
People
Books

I have made the connection in the settings.py at the project level but
in the individual applications suppose People I would like to create
the models that write the tables in that database space and the
application Books to write its models in the Books database. This
should be possible to do but not sure why its not working.

Any thoughts?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.