Re: __unicode__() addition not working in basic poll application.

2011-05-17 Thread maaz muqri
but still I am getting same problem On May 16, 6:58 pm, AJ wrote: > I think you are getting the poll object back. You need to specify the method > for your model class(es) > > def __unicode__(self): >         return "%s %s %s" % (self.poll_name) > > > > > > > > > > On Mon, May 16, 2011 at 8:32 AM

Re: __unicode__() addition not working in basic poll application.

2011-05-17 Thread Roman Klesel
2011/5/16 maaz muqri : > I am getting this > Poll.objects.all() > [] What do you get when you do: print unicode(Poll.objects.all()[0]) ? Regards Roman -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: performance of model instgance save()

2011-05-17 Thread Lucian Nicolescu
I had at similar problem at some point and found that the fasest way was to generate raw sql insert/copy commands - if you're still experimenting you might want to try that as well. On Tue, May 17, 2011 at 12:39 AM, Brian wrote: >> > I'd think you'll find it's significantly more than a factor of

Memcached backend - caching data with infinite timeout

2011-05-17 Thread Paweł Roman
Python-memcached docstring for set() says this: """ @param time: Tells memcached the time which this value should expire, either as a delta number of seconds, or an absolute unix time-since-the-epoch value. See the memcached protocol docs section "Storage Commands" for more info on . We default to

Re: Memcached backend - caching data with infinite timeout

2011-05-17 Thread Malcolm Box
That looks like a bug in Django. I suggest you file a ticket. The fix would be to compare timeout to None Sent from my iPhone, please excuse any typos On 17 May 2011, at 10:54, Paweł Roman wrote: > Python-memcached docstring for set() says this: > > """ > @param time: Tells memcached the ti

Re: Memcached backend - caching data with infinite timeout

2011-05-17 Thread Tom Evans
On Tue, May 17, 2011 at 11:03 AM, Malcolm Box wrote: > That looks like a bug in Django. I suggest you file a ticket. > > The fix would be to compare timeout to None > A ticket has already been submitted about this. The issue is that although memcache allows setting 'infinite' timeouts (its not in

How to register JS event handler

2011-05-17 Thread Thomas Guettler
Hi, I want to register some jquery event handler for some widgets of a form (FooForm). The form gets used in several views. It would be a pain to insert $(function(){...}) in every page which uses this form. The Media Form objects only handles links to JS files. Any hints how to insert the js

Re: __unicode__() addition not working in basic poll application.

2011-05-17 Thread maaz muqri
im just getting "Poll object" as output On May 17, 1:14 pm, Roman Klesel wrote: > 2011/5/16 maaz muqri : > > > I am getting this > > Poll.objects.all() > > [] > > What do you get when you do: > > print unicode(Poll.objects.all()[0]) > > ? > > Regards >  Roman -- You received this message be

Re: How to register JS event handler

2011-05-17 Thread Michal Petrucha
On Tue, May 17, 2011 at 12:34:05PM +0200, Thomas Guettler wrote: > Hi, > > I want to register some jquery event handler for some widgets of a form > (FooForm). The > form gets used in several views. > > It would be a pain to insert $(function(){...}) in every page which uses this > form. > > T

Re: __unicode__() addition not working in basic poll application.

2011-05-17 Thread Roman Klesel
hmm... strange... the __unicode__ thing is nothing django-specific. It works in plain python as well: It's supposed to work like this: >>> class TestClass(object): ... def __unicode__(self): ... return "unicode" ... def __repr__(self): ... return "buh" ... def __str__

Re: Custom Managers and Q() Objects

2011-05-17 Thread Michal Petrucha
On Mon, May 16, 2011 at 11:54:14PM +0200, Marc Aymerich wrote: > > > when I call Model.objects.active_during(Q(Q(ini=some_date, end=some_date) > > | > > > Q(ini=other_date, fin=other_date))) I get This error: > > > > > > > > > active_during() takes exactly 3 arguments (2 given) > > Hi Michal, > Ye

Re: boolean default

2011-05-17 Thread Derek
On May 15, 8:53 pm, Christophe Pettus wrote: > On May 15, 2011, at 2:15 PM, Greg Donald wrote: > > > How do I set a default for a BooleanField() ? > > > I tried > > > foo = models.BooleanField( default=False ) > > > but that only produces > > > foo boolean NOT NULL, > > The default= parameter in D

Re: Custom Managers and Q() Objects

2011-05-17 Thread Marc Aymerich
On Tue, May 17, 2011 at 2:57 PM, Michal Petrucha wrote: > On Mon, May 16, 2011 at 11:54:14PM +0200, Marc Aymerich wrote: > > > > when I call Model.objects.active_during(Q(Q(ini=some_date, > end=some_date) > > > | > > > > Q(ini=other_date, fin=other_date))) I get This error: > > > > > > > > > > > >

Re: Google motion chart problem in django template

2011-05-17 Thread sushanth Reddy
Hi Tarkeshwar, Thank you for the response,But here i am directly passing list to the template, Can you please help me how to extract that list into that date format. Thanks in advance sushanth -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: south django etc.

2011-05-17 Thread William Hudspeth
http://stackoverflow.com/questions/4840102/how-come-my-south-migrations-doesnt-work-for-django On Fri, 2011-05-13 at 07:27 -0700, wilbur wrote: > When loading a Django page, I get the error: > > IntegrityError while rendering: duplicate key value violates unique > constraint "menus_cachekey_pke

how use this snippet

2011-05-17 Thread Tonton
hello i'd like to uderstand how to use this snippet http://djangosnippets.org/snippets/2225/ i don't understand how it works and if it's work does anyone use it before ? regards T. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post t

Re: how use this snippet

2011-05-17 Thread Tom Evans
On Tue, May 17, 2011 at 4:49 PM, Tonton wrote: > hello > > i'd like to uderstand how to use this snippet > > http://djangosnippets.org/snippets/2225/ > > i don't understand how it works and if it's work > > does anyone use it before  ? > > regards > > T. > It's a management command. It belongs in

Re: how use this snippet

2011-05-17 Thread AJ
Many times I do not know how to use some snippets on djangosnippets.org. has anyone else felt the same? I, obviously, am a newbie. On Tue, May 17, 2011 at 12:00 PM, Tom Evans wrote: > On Tue, May 17, 2011 at 4:49 PM, Tonton wrote: > > hello > > > > i'd like to uderstand how to use this snipp

Re: how use this snippet

2011-05-17 Thread Tom Evans
On Tue, May 17, 2011 at 5:04 PM, AJ wrote: > Many times I do not know how to use some snippets on djangosnippets.org. has > anyone else felt the same? I, obviously, am a newbie. > I don't mean to sound glib, but (almost) everything is detailed in the very fine manual. Read, re-read and re-re-read

Re: best framework/reusable app for caching model instances (object level cache) ?

2011-05-17 Thread stargazer
After looking at these libraries... I think the best solution would be not use these kind of libraries (ORM cache) at all. The @cached decorator like from this library: https://bitbucket.org/kmike/django-cache-utils caches ***and invalidates!*** function based on function name and exact paramet

Re: boolean default

2011-05-17 Thread Greg Donald
On Tue, May 17, 2011 at 8:53 AM, Derek wrote: > This is a very subtle point.  The docs for "default": > http://docs.djangoproject.com/en/1.3/ref/models/fields/#default > do not explicitly say anything about creating any SQL-related code; > therefore perhaps best to assume that Django does not.  In

Re: Google motion chart problem in django template

2011-05-17 Thread Tarkeshwar Thakur
Sorry my syntax was incorrect. Change your list construction to be: *ml.append([str(m[selected_mode]),year, month, day, m['total']])* then in template [ {% for mode, year, month, day, total in ml %} '["{{ mode}}", "new Date({{ year }}, {{ month }}, {{ date }})", {{ total }}],' {% endfor %} ] On

Re: how use this snippet

2011-05-17 Thread AJ
Thanks for the great advice Tom. On Tue, May 17, 2011 at 12:33 PM, Tom Evans wrote: > On Tue, May 17, 2011 at 5:04 PM, AJ wrote: > > Many times I do not know how to use some snippets on djangosnippets.org. > has > > anyone else felt the same? I, obviously, am a newbie. > > > > I don't mean to so

default group for new users

2011-05-17 Thread Brian Craft
Is there a good way to add new users to a default group when they are created (e.g. via django-registration)? I just tried binding the post_save signal for User, and adding the group in the signal handler (if "created" is true). However, I haven't found a good place (file) to put the connect() call

Re: Basic Django Support

2011-05-17 Thread Mateusz Marzantowicz
On Sun, May 15, 2011 at 6:07 PM, David Biglin wrote: > Hi, > I have been playing with Python for the past year now and enjoying it. > I am trying Django to make a web site for a friend. I am Following the > Django Tutorial on there web site to get the basic concepts here; > http://docs.djangoproj

REMOTE_USER authentication to 'Admin'?

2011-05-17 Thread Jeff Blaine
Hi folks, I'm successfully using Apache with mod_authnz_ldap, WSGI, Django 1.3. If I hit '/admin', I get asked to authenticate (BasicAuth done through LDAP). I succeed. However, this just results in me then seeing the Django admin login screen instead of logging me in to Admin. What am I mis

Re: default group for new users

2011-05-17 Thread creecode
Hello Brian, I have a similar signal setup for an app of mine. I put it at the end of the models.py file. I seem to recall reading a tip somewhere that this was a good place for something like this. Perhaps it was the Django or django-registration docs? Toodle-lo... cree

Re: default group for new users

2011-05-17 Thread Brian Craft
After much googling, I created a new app called "core" and put the connect() in the __init__.py. That seems to be working. The problem with the "put it in models.py" solution is that it isn't really related to any of my existing apps. Previously I tried putting it in the project __init__.py, but th

Re: REMOTE_USER authentication to 'Admin'?

2011-05-17 Thread Jacob Kaplan-Moss
On Tue, May 17, 2011 at 1:31 PM, Jeff Blaine wrote: > Hi folks, > I'm successfully using Apache with mod_authnz_ldap, WSGI, Django 1.3.  If I > hit > '/admin', I get asked to authenticate (BasicAuth done through LDAP).  I > succeed. > However, this just results in me then seeing the Django admin l

Re: REMOTE_USER authentication to 'Admin'?

2011-05-17 Thread Jeff Blaine
[ *sigh* - I wish the web UI to google groups had an 80-column marker. ] [ Sorry for the formatting in the previous message. I'm used to hitting ] [ enter. ] Thanks for the reply, Jacob. That gets us somewhere, because authenticating to Apache/LDAP as jblaine did NOT make a Django user jblaine.

Re: REMOTE_USER authentication to 'Admin'?

2011-05-17 Thread Jacob Kaplan-Moss
On Tue, May 17, 2011 at 2:00 PM, Jeff Blaine wrote: > That gets us somewhere, because authenticating to Apache/LDAP as jblaine > did NOT make a Django user jblaine. That's interesting - perhaps LDAP is reporting a different username? You could check in the auth_user table to see what's getting cr

Problem in Part2 of the tutorial "DoesNotExist at /admin/"

2011-05-17 Thread igalic
Hi, I went through the first part of the tutorial without problems, but when trying to turn on the admin app in tutorial 2, I got this error page with the message stated in subject line. Here's more info: Django: latest version from the trunk Python: 2.6.1 OS: OSX 10.6.7 Here's the info it give

Re: Email app is breaking long lines, any fix?

2011-05-17 Thread John Crawford
Actually, upon looking more at the output, it has *both* "utf-8" and "us-ascii" as the charset. I'm not sure if this is the result of code changes I've made, or I just missed it the first time around - but my Django email output now looks like this: -- MESSAGE FOLLOWS -- Content-Ty

Re: REMOTE_USER authentication to 'Admin'?

2011-05-17 Thread Jeff Blaine
On Tuesday, May 17, 2011 3:10:03 PM UTC-4, Jacob Kaplan-Moss wrote: > > On Tue, May 17, 2011 at 2:00 PM, Jeff Blaine wrote: > > That gets us somewhere, because authenticating to Apache/LDAP as jblaine > > did NOT make a Django user jblaine. > > That's interesting - perhaps LDAP is reporting a diff

Re: boolean default

2011-05-17 Thread Lucian Nicolescu
AFAIK Django does not create SQL instructions for default values. But if you specify a default value inside the model field declaration and use the orm for inserts it will correctly assign it. Lucian On Tue, May 17, 2011 at 7:49 PM, Greg Donald wrote: > On Tue, May 17, 2011 at 8:53 AM, Derek wr

Re: REMOTE_USER authentication to 'Admin'?

2011-05-17 Thread Jeff Blaine
Also, FWIW, the REMOTE_USER is definitely getting set to 'jblaine' 1xx.xx.xx.231 - jblaine [17/May/2011:16:12:41 -0400] "GET /static/admin/img/admin/nav-bg.gif HTTP/1.1" 200 273 "http://rcf-hostdb.our.org/admin/"; "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .N

Pre fork or worker MPM

2011-05-17 Thread ydjango
I am using Python 2.5, django 1.1 with mod_wsgi 2.5 Does it matter if I use prefork or worker MPM for apache? Which one is recommended for production use? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dja

Re: Memcached backend - caching data with infinite timeout

2011-05-17 Thread Malcolm Box
On 17 May 2011 11:15, Tom Evans wrote: > On Tue, May 17, 2011 at 11:03 AM, Malcolm Box > wrote: > > That looks like a bug in Django. I suggest you file a ticket. > > > > The fix would be to compare timeout to None > > > > A ticket has already been submitted about this. The issue is that > althou

Re: boolean default

2011-05-17 Thread Greg Donald
On Tue, May 17, 2011 at 3:20 PM, Lucian Nicolescu wrote: > AFAIK Django does not create SQL instructions for default values. But > if you specify a default value inside the model field declaration and > use the orm for inserts it will correctly assign it. That's the behavior I expected, but that'

Re: Email app is breaking long lines, any fix?

2011-05-17 Thread Ian Clelland
On Tue, May 17, 2011 at 1:02 PM, John Crawford wrote: > Actually, upon looking more at the output, it has *both* "utf-8" and > "us-ascii" as the charset. Actually, it doesn't. It only has utf-8. The first nine lines of your pasted output are the actual email headers. Following the blank line is

Re: Pre fork or worker MPM

2011-05-17 Thread creecode
Hello ydjango, On Tuesday, May 17, 2011 2:15:37 PM UTC-7, ydjango wrote: I am using Python 2.5, django 1.1 with mod_wsgi 2.5 > > Does it matter if I use prefork or worker MPM for apache? > > Which one is recommended for production use? Which one you choose depends on what you are trying to ac

Re: Pre fork or worker MPM

2011-05-17 Thread Jacob Kaplan-Moss
On Tue, May 17, 2011 at 4:15 PM, ydjango wrote: > I am using Python 2.5, django 1.1 with mod_wsgi 2.5 > > Does it matter if I use prefork or worker MPM for apache? In general, worker will use less RAM, thus allowing higher concurrency and usually higher perceived performance. But take that sugge

Re: Email app is breaking long lines, any fix?

2011-05-17 Thread John Crawford
> What are you *actually* doing to send this email? This is the basic version - the one with two headers, I was experimenting with a MIMEText object: from django.core.mail import send_mail def page_worked(request): the_text = u'this is a test of a really long line that has more words that co

Re: Email app is breaking long lines, any fix?

2011-05-17 Thread John Crawford
> Actually, it doesn't. It only has utf-8. The first nine lines of your pasted output are the actual email headers. Okay, that makes more sense. That particular experiment I was using a MIMEObject's to_string() function. Although I had passed in plain text to the object, clearly it put its own hea

Re: Pre fork or worker MPM

2011-05-17 Thread ydjango
Thank you, I remembered reading this long back - "Django requires Apache 2.x and mod_python 3.x, and you should use Apache’s prefork MPM, as opposed to the worker MPM." I was not sure if prefork is required because of some limitation (like threading issues) in Django 1.1 or python 2.5 or was it b

Re: Pre fork or worker MPM

2011-05-17 Thread Jacob Kaplan-Moss
On Tue, May 17, 2011 at 6:00 PM, ydjango wrote: > I remembered reading this long back - "Django requires Apache 2.x and > mod_python 3.x, and you should use Apache’s prefork MPM, as opposed to > the worker MPM." That statement dates back to when Django wasn't threadsafe (so we're talking pre-1.0

Re: boolean default

2011-05-17 Thread Karen Tracey
On Tue, May 17, 2011 at 5:45 PM, Greg Donald wrote: > On Tue, May 17, 2011 at 3:20 PM, Lucian Nicolescu > wrote: > > AFAIK Django does not create SQL instructions for default values. But > > if you specify a default value inside the model field declaration and > > use the orm for inserts it will

Error when try to do ManyToMany relation with User class...

2011-05-17 Thread Chris Seberino
I have 3 classes that have a ManyToMany relation with the User class. When I try to do syncdb I get this error Error: One or more models did not validate: mvc.course: 'users' has an m2m relation with model User, which has either not been installed or is abstract. mvc.homework: 'users' has an

TemplateView and dynamic template_name in urlconf

2011-05-17 Thread Brian Morton
I have a generic view that accepts its template_name attribute from the urlconf dynamic variable: (r'^(?P[^/]+)$', TemplateView.as_view()), But I get an exception: TemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names()' I've read the c

Re: Error when try to do ManyToMany relation with User class...

2011-05-17 Thread Kenneth Gonsalves
On Tue, 2011-05-17 at 18:26 -0700, Chris Seberino wrote: > Error: One or more models did not validate: > mvc.course: 'users' has an m2m relation with model User, which has > either not been installed or is abstract. > mvc.homework: 'users' has an m2m relation with model User, which has > either not

Re: how use this snippet

2011-05-17 Thread Gabriel Gunderson
On Tue, May 17, 2011 at 10:33 AM, Tom Evans wrote: > I don't mean to sound glib, but (almost) everything is detailed in the > very fine manual. Read, re-read and re-re-read the manual - even the > boring bits! I think it's important to remember that one of the strengths of Django is its docs. Th

Re: Problem in Part2 of the tutorial "DoesNotExist at /admin/"

2011-05-17 Thread Gabriel Gunderson
On Tue, May 17, 2011 at 11:53 AM, igalic wrote: > I went through the first part of the tutorial without problems, but > when trying to turn on the admin app in tutorial 2, I got this error > page with the message stated in subject line. > > Here's more info: > > Django: latest version from the tru

Re: Error when try to do ManyToMany relation with User class...

2011-05-17 Thread Gabriel Gunderson
On Tue, May 17, 2011 at 7:26 PM, Chris Seberino wrote: > I have 3 classes that have a ManyToMany relation with the User class. > > When I try to do syncdb I get this error > > Error: One or more models did not validate: > mvc.course: 'users' has an m2m relation with model User, which has > eit