Re: Django on Mac OS X
It won't work by commenting the timezone field since it has been created with a non null constraint on your db. Have you tried to get_or_create the account with timezone and language set to some value ? Regards, Xavier. Le 8 août 2010 à 04:09, Daniel França a écrit : > More information. > here: > def create_account(sender, instance=None, **kwargs): > if instance is None: > return > account, created = Account.objects.get_or_create(user=instance) > > post_save.connect(create_account, sender=User) > > If I comment the post_save.connect, there's no exception =) but, of course > the code doesn't do what it should do. > > So, I don't know why, but the error is in the connect... maybe because of > timezone attribute of user > anyone has any idea? > > 2010/8/7 Daniel França > Xavier, I think we are almost there :P > because there's a timezone field in my account model: > > class Account(models.Model): > > user = models.ForeignKey(User, unique=True, verbose_name=_('user')) > > timezone = TimeZoneField(_('timezone')) > language = models.CharField(_('language'), max_length=10, > choices=settings.LANGUAGES, default=settings.LANGUAGE_CODE) > > def __unicode__(self): > return self.user.username > > I tried to comment the line, but then the create_user abort with an > constraint timezone error. > > On Sat, Aug 7, 2010 at 2:22 PM, Xavier Ordoquy wrote: > And what's your Account model ? > I noticed it is in its get_or_create that you get the error. > > Regards, > Xavier. > > Le 7 août 2010 à 18:52, Daniel França a écrit : > >> Same error =/ >> but now,I don't know why.. it's saving at the db. The error still happens, >> but the data is in the database >> >> On Sat, Aug 7, 2010 at 12:54 PM, Xavier Ordoquy wrote: >> Sorry, I just woke up form a sleep :) >> I notice you get-or-create a user. >> However, did you try to call get or create with specifying the arguments ? >> first_name = "...", and so on ? >> Does it still give an error ? >> >> Regards, >> Xavier. >> >> Le 7 août 2010 à 17:46, Xavier Ordoquy a écrit : >> >>> I just googled your error and found: >>> http://www.nerdydork.com/django-programmingerror-cant-adapt.html >>> According to the first comment, you might do something wrong with the >>> arguments types. >>> Unless you give a table description (\d from psql shell) and the model I'm >>> not sure I can help you further. >>> >>> Regards, >>> Xavier. >>> >>> As the stack seems to have a >>> >>> Le 7 août 2010 à 17:21, Daniel França a écrit : >>> I just created my db using django manage syncdb, I think it should create right. or how can I see the encode of each tables? I'm using postgresql 8.4 maybe I'll need reinstall everything =S On Sat, Aug 7, 2010 at 6:49 AM, Xavier Ordoquy wrote: Le 7 août 2010 à 06:44, Daniel França a écrit : > My database is UTF-8, it's fine, doesn't?. > I'm afraid to reinstall everything from ports and start to get a lot > 64-32 bits incompatible issues like happened before =/ I think that should be fine with a utf-8 DB. Are you sure your tables are UTF-8 ? What database are you using ? mysql ? postgres ? I had no issue with both and I have a couple of non pure ascii sites. However, when I moved to snow leopard, I recompiled mysql/postgres and the python drivers. Regards, Xavier. -- 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. -- 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. >>> >>> >>> -- >>> 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. >> >> >> -- >> 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
Re: Value Error in Pyfacebook
2010/8/8 Pankaj Singh : > problem got solved > > 1292 if params.get('expires'): > 1293 self.session_key_expires = int(params['expires']) > > I've just changed it to: > > 1292 if params.get('expires'): > > 1293 try: > 1294 self.session_key_expires = int(params['expires']) > 1295 except ValueError: > 1296 pass > Which can be simplified to: self.session_key_expires = int(params.get('expires') or 0) Regards, -- Fabián E. Gallina http://www.from-the-cloud.com -- 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: manually add objects to a QuerySet
On 8 août 2010, at 06:15, chefsmart wrote: > I had asked this on stackoverflow, but I guess I couldn't explain > myself clearly enough. I'll try to ask again here: > > Say I have two objects obj1 and obj2 of the same model (MyModel), now > I would like to add these objects to a new QuerySet. Can I create a > QuerySet manually like the following > > my_qs = QuerySet(model=MyModel) > > and then add obj1 and obj2 to this QuerySet like > > my_qs.add(obj1) > my_qs.add(obj2) > > Regards, > CM. > What would the use case be, which would prevent you from using a normal list? > -- 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: manually add objects to a QuerySet
You can't really add an object to queryset like that. If you don't want to generate a list in the view, you can chain the querysets chained_qs = chain(qs1,qs2) On Sun, Aug 8, 2010 at 9:45 AM, chefsmart wrote: > I had asked this on stackoverflow, but I guess I couldn't explain > myself clearly enough. I'll try to ask again here: > > Say I have two objects obj1 and obj2 of the same model (MyModel), now > I would like to add these objects to a new QuerySet. Can I create a > QuerySet manually like the following > > my_qs = QuerySet(model=MyModel) > > and then add obj1 and obj2 to this QuerySet like > > my_qs.add(obj1) > my_qs.add(obj2) > > Regards, > CM. > > > -- > 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. > > -- 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: manually add objects to a QuerySet
The objects are coming from mutually exclusive querysets. I need to pass a queryset of these objects to a function. On Aug 8, 1:25 pm, Masklinn wrote: > On 8 août 2010, at 06:15, chefsmart wrote: > > > I had asked this on stackoverflow, but I guess I couldn't explain > > myself clearly enough. I'll try to ask again here: > > > Say I have two objects obj1 and obj2 of the same model (MyModel), now > > I would like to add these objects to a new QuerySet. Can I create a > > QuerySet manually like the following > > > my_qs = QuerySet(model=MyModel) > > > and then add obj1 and obj2 to this QuerySet like > > > my_qs.add(obj1) > > my_qs.add(obj2) > > > Regards, > > CM. > > What would the use case be, which would prevent you from using a normal list? > > -- 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.
Search Field on All Pages
Hi, I want a search field on all my pages and was wondering the best way to do this. I could create a function and import it to every view but this doesn't seem to follow the django DRY principles. I was wondering if anyone had any advice on how to best do this with django? Thank in advance Wes -- 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: Search Field on All Pages
What I do is to setup a search that works at /search/q=search_term, and then create a form on each page that submits to /search. This form is in my top level site template. The /search/ url is part of a search application. There's an example of this working at http://www.brassbandresults.co.uk/ Hope that helps, Tim. On 08/08/10 10:41, wchildsuk wrote: Hi, I want a search field on all my pages and was wondering the best way to do this. I could create a function and import it to every view but this doesn't seem to follow the django DRY principles. I was wondering if anyone had any advice on how to best do this with django? Thank in advance Wes -- 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: Search Field on All Pages
On 8/8/2010 5:41 AM, wchildsuk wrote: > Hi, > > I want a search field on all my pages and was wondering the best way > to do this. I could create a function and import it to every view but > this doesn't seem to follow the django DRY principles. > > I was wondering if anyone had any advice on how to best do this with > django? > > Thank in advance > The usual way would be to use template inheritance. Put the search form in your base template and have your remaining templates extend that base template. http://docs.djangoproject.com/en/dev/topics/templates/#template-inheritance regards Steve -- I'm no expert. "ex" == "has-been"; "spurt" == "drip under pressure" "expert" == "has-been drip under pressure". -- 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: Search Field on All Pages
It seems the question is answered. To continue, Tim, do you use haystack? I passed its beginning tutorial and configured with xapian through haystack-xapian module. Now I'm discovering the other haystack docs and api. Not everything is clear. For example I have a user with name Bob. When I type in the search "ob", it does not return the result, only if I type "Bob", or "bob". -- 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: Search Field on All Pages
Also I will be happy if someone can explain the drill-down (faceting) or “More Like This” features. -- 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.
Replace Admin Site Foreign Key Field/Dropdown with Textbox?
For foreign key fields in the Django Admin, the default display element is a drop down list box containing all of the foreign key items from the related model. I have an asset tracking instance where this drop down box can contain hundreds of thousands of items and I am looking to not have the admin load them all. Is there a way to override the admin interface and have it use a text box instead of the populated drop down? -- 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: Search Field on All Pages
On Aug 8, 2010, at 2:04 PM, Tim Sawyer wrote: What I do is to setup a search that works at /search/q=search_term, and then create a form on each page that submits to /search. This form is in my top level site template. The /search/ url is part of a search application. There's an example of this working at http://www.brassbandresults.co.uk/ Hope that helps, Tim. On 08/08/10 10:41, wchildsuk wrote: Hi, I want a search field on all my pages and was wondering the best way to do this. I could create a function and import it to every view but this doesn't seem to follow the django DRY principles. Personally, I like all of my forms to be classes. If you want that, you should create a context processor. http://docs.djangoproject.com/en/dev/ref/templates/api/#writing-your-own-context-processors Cheers, Roald -- 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: Replace Admin Site Foreign Key Field/Dropdown with Textbox?
On Sun, Aug 8, 2010 at 4:00 PM, sixpackistan wrote: > For foreign key fields in the Django Admin, the default display > element is a drop down list box containing all of the foreign key > items from the related model. I have an asset tracking instance where > this drop down box can contain hundreds of thousands of items and I am > looking to not have the admin load them all. Is there a way to > override the admin interface and have it use a text box instead of the > populated drop down? Yup, documented right here: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.raw_id_fields Cheers, Martin -- 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.
Filtering and the letter å
I am developing a web application for maintaining spellcheck dictionaries. I have noticed that when I filter database records like this: words = Word.objects.filter(lemma='male') I'll also get 'måle' among the hits. This is also the case for its uppercase counterpart, Å. However, I don't get the same behaviour for other Scandinavian letters like ø/Ø. Could this be a bug? -- 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: Filtering and the letter å
this depends on the charset of your database/table >reply to message: >date: 08.08.2010 07:45:06 >from: "finn" >to: "Django users" >subject: Filtering and the letter å > >I am developing a web application for maintaining spellcheck >dictionaries. I have noticed that when I filter database records like >this: > >words = Word.objects.filter(lemma='male') > >I'll also get 'måle' among the hits. This is also the case for its >uppercase counterpart, Å. However, I don't get the same behaviour for >other Scandinavian letters like ø/Ø. > >Could this be a bug? > >-- >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. > -- 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: Come on, share your django powered sites with others.//Fwd: A tornado powered site to show any project powered sites(open source)
On Aug 7, 9:50 pm, Stone Puzzle wrote: > Django powered sites list http://django.poweredsites.org A much more complete database is at http://www.djangosites.org/ ./s -- 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: Search Field on All Pages
On 08/08/10 14:48, kostia wrote: To continue, Tim, do you use haystack? I passed its beginning tutorial and configured with xapian through haystack-xapian module. Now I'm discovering the other haystack docs and api. Not everything is clear. For example I have a user with name Bob. When I type in the search "ob", it does not return the result, only if I type "Bob", or "bob". Not on http://www.brassbandresults.co.uk/. The search field there searches just the name field of various model objects so it's easier to just do model selects. Here's an article I wrote after using Haystack and Whoosh to improve the search on http://www.drumcoder.co.uk/, if that helps. http://drumcoder.co.uk/blog/2010/may/19/django-text-search-haystack-and-whoosh/ Tim. -- 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: manually add objects to a QuerySet
On 8 elo, 11:55, chefsmart wrote: > The objects are coming from mutually exclusive querysets. I need to > pass a queryset of these objects to a function. "Or" the querysets together? In [2]: f1 = Foo1() In [3]: f1.save() In [4]: f2 = Foo1() In [5]: f2.save() In [6]: [f.pk for f in Foo1.objects.all()] Out[6]: [1, 2] In [7]: qs2 = Foo1.objects.filter(pk=1) | Foo1.objects.filter(pk=2) # The oring of querysets In [8]: [f.pk for f in qs2] Out[8]: [1, 2] - Anssi > On Aug 8, 1:25 pm, Masklinn wrote: > > > > > On 8 août 2010, at 06:15, chefsmart wrote: > > > > I had asked this on stackoverflow, but I guess I couldn't explain > > > myself clearly enough. I'll try to ask again here: > > > > Say I have two objects obj1 and obj2 of the same model (MyModel), now > > > I would like to add these objects to a new QuerySet. Can I create a > > > QuerySet manually like the following > > > > my_qs = QuerySet(model=MyModel) > > > > and then add obj1 and obj2 to this QuerySet like > > > > my_qs.add(obj1) > > > my_qs.add(obj2) > > > > Regards, > > > CM. > > > What would the use case be, which would prevent you from using a normal > > list? -- 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.
Party Time at DjangoCon
Thanks to our sponsors for this: http://djangocon.us/blog/2010/08/08/party-time-djangonauts/ regards Steve -- I'm no expert. "ex" == "has-been"; "spurt" == "drip under pressure" "expert" == "has-been drip under pressure". -- 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.
Querying in a loop - cached results?
I'm having a problem that I can't figure out from reading the docs. I have a loop that runs the same query every five minutes, to see if there is new data to process. However, it doesn't return the new data the second and subsequent times it loops. It's something like this: while 1: data = Foo.objects.filter(not_analyzed=True) if len(data): for item in data: do_analysis(item) sleep(300) Even though I know there is new data added while it is sleeping, the query doesn't return it. If I kill the process and re-start, it finds the new data, so it smells like a caching problem... but I don't see anything in the documentation that would suggest this. It shouldn't be the database query cache (MySQL) because it should know the data has changed. I've tried adding "del data" at the bottom of the loop, but that didn't help - thought maybe if I explicitly deleted the data, that would work. Any ideas what's going on or how to solve this? TIA, Nick -- 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: Search Field on All Pages
What about creating a template_tag for the form? Is that a good way to add it to several templates? 2010/8/8 Roald de Vries > On Aug 8, 2010, at 2:04 PM, Tim Sawyer wrote: > >> What I do is to setup a search that works at /search/q=search_term, and >> then create a form on each page that submits to /search. >> >> > type="submit" value="Search"> >> >> This form is in my top level site template. The /search/ url is part of a >> search application. >> >> There's an example of this working at http://www.brassbandresults.co.uk/ >> >> Hope that helps, >> >> Tim. >> >> On 08/08/10 10:41, wchildsuk wrote: >> >>> Hi, >>> >>> I want a search field on all my pages and was wondering the best way >>> to do this. I could create a function and import it to every view but >>> this doesn't seem to follow the django DRY principles. >>> >> > Personally, I like all of my forms to be classes. If you want that, you > should create a context processor. > > > http://docs.djangoproject.com/en/dev/ref/templates/api/#writing-your-own-context-processors > > Cheers, Roald > > > -- > 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. > > -- André Santos Teixeira de Carvalho Undergraduating in Computer Science DCC/UFRJ -- 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.
Issue with using subprocess.Popen inside a view
Hi All, I am facing a problem with using subprocess.Popen inside my views. The program that I am trying to run using Popen, tries to talk to a device on the network providing input to various prompts coughed up by the device. Unfortunately, a response is being gobbled up somewhere causing the program to hang. The execution stalls until the prompt is answered (which never happens). The strange thing is, if I were to invoke the same Popen call from inside a regular python module, it runs without any hitch. The problem is seen only if the program is called from inside a Django view. I've tried various things like substituting Popen with os.System etc., but have had no luck so far. I've posted this question at stackoverflow as well (http:// stackoverflow.com/questions/3422775/subprocess-popen-hangs-with- interactive-programs-when-called-from-inside-django). Go to that post for snippets of the problematic code. Thanks for any help. -Z -- 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 do I recover my password on the django website?
I'm trying to submit a ticket to http://code.djangoproject.com/ and need to login. I must have created an account long ago because it says my email address is already in use, but I have long since forgotten my username and password. I don't see any mechanism to recover them. My apologies if this is off-topic for this list. -- 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: Search Field on All Pages
Yes, somebody can use template tag, somebody content processor and the most intuitive solution is to use template inheritance, as was suggested. Thank you, Tim. Wish you good luck. I loved your musician web site. -- 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: Filtering and the letter å
On Aug 8, 1:45 pm, finn wrote: > I am developing a web application for maintaining spellcheck > dictionaries. I have noticed that when I filter database records like > this: > > words = Word.objects.filter(lemma='male') > > I'll also get 'måle' among the hits. This is also the case for its > uppercase counterpart, Å. However, I don't get the same behaviour for > other Scandinavian letters like ø/Ø. > > Could this be a bug? Functions like filtering and sorting are performed by your database. And databases use something called 'collation' to determine which letters are considered equal in queries. In your case I would check the collation of your tables, and look in the documentation for your database to work out which collation to use if you want to change the current behaviour. -- DR. -- 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: Querying in a loop - cached results?
On Aug 8, 6:03 pm, Nick Arnett wrote: > I'm having a problem that I can't figure out from reading the docs. I have > a loop that runs the same query every five minutes, to see if there is new > data to process. However, it doesn't return the new data the second and > subsequent times it loops. It's something like this: > > while 1: > data = Foo.objects.filter(not_analyzed=True) > if len(data): > for item in data: > do_analysis(item) > sleep(300) > > Even though I know there is new data added while it is sleeping, the query > doesn't return it. If I kill the process and re-start, it finds the new > data, so it smells like a caching problem... but I don't see anything in the > documentation that would suggest this. It shouldn't be the database query > cache (MySQL) because it should know the data has changed. > > I've tried adding "del data" at the bottom of the loop, but that didn't help > - thought maybe if I explicitly deleted the data, that would work. > > Any ideas what's going on or how to solve this? > > TIA, > > Nick Where is this query running - in a view, or an external script? And how is the data being added to the db? -- DR. -- 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: Replace Admin Site Foreign Key Field/Dropdown with Textbox?
You can also hide that field which inturn will not load it on page by using "fields" attribute in admin class for that particular model and specify all the fields required to be shown on change list page. Just omit the Foreign Key field in the "fields" list in case u don't need it in admin. Carpe Diem, //Vikalp On Sun, Aug 8, 2010 at 7:40 PM, Martin Melin wrote: > On Sun, Aug 8, 2010 at 4:00 PM, sixpackistan wrote: > > For foreign key fields in the Django Admin, the default display > > element is a drop down list box containing all of the foreign key > > items from the related model. I have an asset tracking instance where > > this drop down box can contain hundreds of thousands of items and I am > > looking to not have the admin load them all. Is there a way to > > override the admin interface and have it use a text box instead of the > > populated drop down? > > Yup, documented right here: > > http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.raw_id_fields > > Cheers, > Martin > > -- > 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. > > -- 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 interactive shell shows invalid datetime
Dear friends, I am just wondering how comes django interactive shell shows wrong datetime. I.e my system correct time (python shell) shows print datetime.datetime.now() --> ``2010-08-09 00:44:33.439732`` and django interactive shell shows wrong time print datetime.datetime.now()--> ``2010-08-09 10:13:47.457335``. So almost 10 hours greater than the current time. How comes its possible ? How can I solve this? Thanks for spending time to reading my issue.. Jayapal D -- 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 interactive shell shows invalid datetime
On 8/8/2010 3:19 PM, jai_python wrote: > Dear friends, > I am just wondering how comes django interactive shell shows > wrong datetime. I.e my system correct time (python shell) shows print > datetime.datetime.now() --> ``2010-08-09 00:44:33.439732`` and django > interactive shell shows wrong time print datetime.datetime.now()--> > ``2010-08-09 10:13:47.457335``. So almost 10 hours greater than the > current time. How comes its possible ? How can I solve this? > > Thanks for spending time to reading my issue.. > > Jayapal D > I'll guess that your time zone is ten hours away from Chicago. Django uses the zone from the settings.py file., regards Steve -- I'm no expert. "ex" == "has-been"; "spurt" == "drip under pressure" "expert" == "has-been drip under pressure". -- 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 podcasting software?
Hello, A couple of friends want to start a podcast and have come to me for the technical side. And I will like it to be python, because I don't want to go with podpress for that site. I will like to know if anyone has any good/bad experiences with http://github.com/jefftriplett/django-podcast ? I will also like to know if the source for http://djangodose.com/is available as open source or if they are using django-podcast underneath. -- 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 do I recover my password on the django website?
On Sun, Aug 8, 2010 at 1:29 PM, Roy Smith wrote: > I'm trying to submit a ticket to http://code.djangoproject.com/ and > need to login. I must have created an account long ago because it > says my email address is already in use, but I have long since > forgotten my username and password. I don't see any mechanism to > recover them. > > My apologies if this is off-topic for this list. > You can request a password reset here: http://www.djangoproject.com/accounts/password/reset/ Karen -- http://tracey.org/kmt/ -- 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: Querying in a loop - cached results?
On Sun, Aug 8, 2010 at 1:03 PM, Nick Arnett wrote: > I'm having a problem that I can't figure out from reading the docs. I have > a loop that runs the same query every five minutes, to see if there is new > data to process. However, it doesn't return the new data the second and > subsequent times it loops. It's something like this: > > while 1: > data = Foo.objects.filter(not_analyzed=True) > if len(data): > for item in data: >do_analysis(item) > sleep(300) > > Even though I know there is new data added while it is sleeping, the query > doesn't return it. If I kill the process and re-start, it finds the new > data, so it smells like a caching problem... but I don't see anything in the > documentation that would suggest this. It shouldn't be the database query > cache (MySQL) because it should know the data has changed. > > I've tried adding "del data" at the bottom of the loop, but that didn't > help - thought maybe if I explicitly deleted the data, that would work. > > Any ideas what's going on or how to solve this? > > Probably you are seeing the effects of the default transaction isolation level on MySQL/InnoDB, which is "repeatable read". See http://groups.google.com/group/django-users/browse_thread/thread/e25cec400598c06dfor more explanation. Karen -- http://tracey.org/kmt/ -- 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: Querying in a loop - cached results?
On Sun, Aug 8, 2010 at 11:52 AM, Daniel Roseman wrote: > > > Where is this query running - in a view, or an external script? And > how is the data being added to the db? In both cases -- adding data and analyzing -- it is an external script, using the Django ORM. Nick -- 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: Querying in a loop - cached results?
On Sun, Aug 8, 2010 at 3:09 PM, Karen Tracey wrote: > > Probably you are seeing the effects of the default transaction isolation >> level on MySQL/InnoDB, which is "repeatable read". See >> http://groups.google.com/group/django-users/browse_thread/thread/e25cec400598c06dfor >> more explanation. > > Ah, I didn't think of that. Didn't even think about the fact that there are transactions going on behind the curtain. I'll look into that. Nick -- 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.
unexpected error with inline model
Hi, I'm trying to use inline models, and I've configured my admin.py like so. from django.contrib import admin from opag.main.models import Notice, Meeting, MeetingTalk class NoticeAdmin(admin.ModelAdmin): list_display = ('title', 'visible') list_display_links = ('title',) class MeetingTalkInline(admin.StackedInline): model = MeetingTalk class MeetingAdmin(admin.ModelAdmin): list_display = ('date', 'firm', 'speakers_wanted') list_display_links = ('date',) list_filter = ('firm',) admin.site.register(Notice, NoticeAdmin) admin.site.register(Meeting, MeetingAdmin) admin.site.register(MeetingTalk, MeetingTalkInline) Unfortunately, as long as the list_display property is present in the MeetingAdmin model, I get this error AttributeError at /admin/main/meeting/add/ type object 'MeetingTalkInline' has no attribute 'date_hierarchy' Am I doing something wrong here? Thanks, Mike -- Michael P. Soulier "Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction." --Albert Einstein signature.asc Description: Digital signature
SQL generated for ManyToManyField is incorrect with Django 1.2.1
Hi, I was just trying the sample code from the Django Book 2nd Edition but the generated SQL script for the Books models are not correct. The Model code: http://dpaste.com/226416/ The generated SQL script for sqlite: http://dpaste.com/226417/ What's missing in the generated script is 'REFERENCES "books_book" ("id")' for the "book_id" field in the "books_book_authors" table. (The code listing in the book has it.) Am I missing something or Django 1.2.1 just generates incorrect script? Thanks. -- 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: SQL generated for ManyToManyField is incorrect with Django 1.2.1
On Mon, Aug 9, 2010 at 7:28 AM, Ersin Er wrote: > Hi, > > I was just trying the sample code from the Django Book 2nd Edition but > the generated SQL script for the Books models are not correct. > > The Model code: > > http://dpaste.com/226416/ > > The generated SQL script for sqlite: > > http://dpaste.com/226417/ > > What's missing in the generated script is > 'REFERENCES "books_book" ("id")' > for the "book_id" field > in the "books_book_authors" table. (The code listing in the book has > it.) > > Am I missing something or Django 1.2.1 just generates incorrect > script? The SQL generated by Django 1.2.1 isn't incorrect - it's just different. Django 1.2 introduced a number of internal changes to the way many-to-many fields were represented; as a result, the output SQL has changed slightly. The output described by the Django Book is out of date, but not in any way that matters at a functional level -- the public API for using m2m fields remains unchanged. Yours, Russ Magee %-) -- 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: unexpected error with inline model
> type object 'MeetingTalkInline' has no attribute 'date_hierarchy' date_hierarchy is an attribute expected to be with every 'normal' admin classes. Why do django tries to search it in your inline admin? Just because you have registered it as you do with normal admins. Usually, inlines are not to be registered with admin.site but you've to specify them in the 'inlines' list of the admin of which you want they are a part of. Go thru the tutorials once more. -- 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: moving to django 1.2.1
On 31/07/10 Russell Keith-Magee said: > * If you have an existing project, the introduction of CSRF > protection in Django 1.2 shouldn't pose any obstacle to upgrading. > CSRF protection is turned on by default in new projects, but you need > to manually turn it on for existing projects (i.e., you need to add > the new middleware). If you don't add the new middleware, you don't > need to do anything in order to run your project under Django 1.2. The > only potential backwards incompatibility is if you have written custom > templates to override the default templates provided by Django's admin > -- but this is clearly highlighted in the release notes [2]. > > [2] http://docs.djangoproject.com/en/dev/releases/1.2/#csrf-protection I've picked-up Django 1.2 locally in a virtualenv for testing, and I'm finding suddenly that I can't login to the admin site due to a CSRF error. I have not enabled CSRF yet, and I have not added custom admin templates. I'm assuming that this is not expected. Mike -- Michael P. Soulier "Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction." --Albert Einstein signature.asc Description: Digital signature
Re: moving to django 1.2.1
On 08/08/10 Michael P. Soulier said: > I've picked-up Django 1.2 locally in a virtualenv for testing, and I'm > finding suddenly that I can't login to the admin site due to a CSRF error. Ah, found it. Somehow some firefox add-on disabled my accepting of cookies. The error I saw didn't mention that possibility. Mike -- Michael P. Soulier "Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction." --Albert Einstein signature.asc Description: Digital signature
include(admin.site.urls)
Hi, I saw the deprecation warning on using admin.site.root in my urlconf for the admin site, so I moved to include(admin.site.urls) instead. Unfortunately after I logged-in, every click in the admin site took me nowhere (reloaded the same page). Any idea of what could cause that? I've moved back to admin.site.root and it works fine. Mike -- Michael P. Soulier "Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction." --Albert Einstein signature.asc Description: Digital signature
Customizing django admin
Hi, For a modeladmin,I need to show a custom template when user adds or edits.How can I go about implementing this functionality? thanks -- 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 on Mac OS X
tried, nothing :( I'm getting crazy with Mac OS, I think I'll go back to Linux :S On Sun, Aug 8, 2010 at 4:34 AM, Xavier Ordoquy wrote: > It won't work by commenting the timezone field since it has been created > with a non null constraint on your db. > Have you tried to get_or_create the account with timezone and language set > to some value ? > > Regards, > Xavier. > > Le 8 août 2010 à 04:09, Daniel França a écrit : > > More information. > here: > def create_account(sender, instance=None, **kwargs): > if instance is None: > return > account, created = Account.objects.get_or_create(user=instance) > > post_save.connect(create_account, sender=User) > > If I comment the *post_save.connect*, there's no exception =) but, of > course the code doesn't do what it should do. > > So, I don't know why, but the error is in the connect... maybe because of > timezone attribute of user > anyone has any idea? > > 2010/8/7 Daniel França > >> Xavier, I think we are almost there :P >> because there's a timezone field in my account model: >> >> class Account(models.Model): >> >> user = models.ForeignKey(User, unique=True, verbose_name=_('user')) >> >> timezone = TimeZoneField(_('timezone')) >> language = models.CharField(_('language'), max_length=10, >> choices=settings.LANGUAGES, default=settings.LANGUAGE_CODE) >> >> def __unicode__(self): >> return self.user.username >> >> I tried to comment the line, but then the create_user abort with an >> constraint timezone error. >> >> On Sat, Aug 7, 2010 at 2:22 PM, Xavier Ordoquy wrote: >> >>> And what's your Account model ? >>> I noticed it is in its get_or_create that you get the error. >>> >>> Regards, >>> Xavier. >>> >>> Le 7 août 2010 à 18:52, Daniel França a écrit : >>> >>> Same error =/ >>> but now,I don't know why.. it's saving at the db. The error still >>> happens, but the data is in the database >>> >>> On Sat, Aug 7, 2010 at 12:54 PM, Xavier Ordoquy wrote: >>> Sorry, I just woke up form a sleep :) I notice you get-or-create a user. However, did you try to call get or create with specifying the arguments ? first_name = "...", and so on ? Does it still give an error ? Regards, Xavier. Le 7 août 2010 à 17:46, Xavier Ordoquy a écrit : I just googled your error and found: http://www.nerdydork.com/django-programmingerror-cant-adapt.html According to the first comment, you might do something wrong with the arguments types. Unless you give a table description (\d from psql shell) and the model I'm not sure I can help you further. Regards, Xavier. As the stack seems to have a Le 7 août 2010 à 17:21, Daniel França a écrit : I just created my db using django manage syncdb, I think it should create right. or how can I see the encode of each tables? I'm using postgresql 8.4 maybe I'll need reinstall everything =S On Sat, Aug 7, 2010 at 6:49 AM, Xavier Ordoquy wrote: > > Le 7 août 2010 à 06:44, Daniel França a écrit : > > > My database is UTF-8, it's fine, doesn't?. > > I'm afraid to reinstall everything from ports and start to get a lot > 64-32 bits incompatible issues like happened before =/ > > I think that should be fine with a utf-8 DB. > Are you sure your tables are UTF-8 ? > What database are you using ? mysql ? postgres ? I had no issue with > both and I have a couple of non pure ascii sites. > However, when I moved to snow leopard, I recompiled mysql/postgres and > the python drivers. > > Regards, > Xavier. > > -- > 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. > > -- 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. -- 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. -- You received this message because you are subscribed to the Google Groups "Django us
Re: manually add objects to a QuerySet
Since I already have the objects, I don't want to hit the database again. There are not just two but multiple objects, that's why I want to avoid unnecessary db calls. On Aug 8, 9:54 pm, akaariai wrote: > On 8 elo, 11:55, chefsmart wrote: > > > The objects are coming from mutually exclusive querysets. I need to > > pass aquerysetof these objects to a function. > > "Or" the querysets together? > In [2]: f1 = Foo1() > In [3]: f1.save() > In [4]: f2 = Foo1() > In [5]: f2.save() > In [6]: [f.pk for f in Foo1.objects.all()] > Out[6]: [1, 2] > In [7]: qs2 = Foo1.objects.filter(pk=1) | Foo1.objects.filter(pk=2) # > The oring of querysets > In [8]: [f.pk for f in qs2] > Out[8]: [1, 2] > > - Anssi > > > On Aug 8, 1:25 pm, Masklinn wrote: > > > > On 8 août 2010, at 06:15, chefsmart wrote: > > > > > I had asked this on stackoverflow, but I guess I couldn't explain > > > > myself clearly enough. I'll try to ask again here: > > > > > Say I have two objects obj1 and obj2 of the same model (MyModel), now > > > > I would like to add these objects to a newQuerySet. Can I create a > > > >QuerySetmanuallylike the following > > > > > my_qs =QuerySet(model=MyModel) > > > > > and then add obj1 and obj2 to thisQuerySetlike > > > > > my_qs.add(obj1) > > > > my_qs.add(obj2) > > > > > Regards, > > > > CM. > > > > What would the use case be, which would prevent you from using a normal > > > list? -- 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 on Mac OS X
I tried to reinstall everything... installing python+postgres from ports and I get the Symbol not found: _PQbackendPID error again from psycopg. I guess the best solution is run Ubuntu on a virtual machine or my project will be stuck forever. python+psycopg on mac just sux. 2010/8/8 Daniel França > tried, nothing :( > I'm getting crazy with Mac OS, I think I'll go back to Linux :S > > > On Sun, Aug 8, 2010 at 4:34 AM, Xavier Ordoquy wrote: > >> It won't work by commenting the timezone field since it has been created >> with a non null constraint on your db. >> Have you tried to get_or_create the account with timezone and language set >> to some value ? >> >> Regards, >> Xavier. >> >> Le 8 août 2010 à 04:09, Daniel França a écrit : >> >> More information. >> here: >> def create_account(sender, instance=None, **kwargs): >> if instance is None: >> return >> account, created = Account.objects.get_or_create(user=instance) >> >> post_save.connect(create_account, sender=User) >> >> If I comment the *post_save.connect*, there's no exception =) but, of >> course the code doesn't do what it should do. >> >> So, I don't know why, but the error is in the connect... maybe because of >> timezone attribute of user >> anyone has any idea? >> >> 2010/8/7 Daniel França >> >>> Xavier, I think we are almost there :P >>> because there's a timezone field in my account model: >>> >>> class Account(models.Model): >>> >>> user = models.ForeignKey(User, unique=True, verbose_name=_('user')) >>> >>> timezone = TimeZoneField(_('timezone')) >>> language = models.CharField(_('language'), max_length=10, >>> choices=settings.LANGUAGES, default=settings.LANGUAGE_CODE) >>> >>> def __unicode__(self): >>> return self.user.username >>> >>> I tried to comment the line, but then the create_user abort with an >>> constraint timezone error. >>> >>> On Sat, Aug 7, 2010 at 2:22 PM, Xavier Ordoquy wrote: >>> And what's your Account model ? I noticed it is in its get_or_create that you get the error. Regards, Xavier. Le 7 août 2010 à 18:52, Daniel França a écrit : Same error =/ but now,I don't know why.. it's saving at the db. The error still happens, but the data is in the database On Sat, Aug 7, 2010 at 12:54 PM, Xavier Ordoquy wrote: > Sorry, I just woke up form a sleep :) > I notice you get-or-create a user. > However, did you try to call get or create with specifying the > arguments ? first_name = "...", and so on ? > Does it still give an error ? > > Regards, > Xavier. > > Le 7 août 2010 à 17:46, Xavier Ordoquy a écrit : > > I just googled your error and found: > http://www.nerdydork.com/django-programmingerror-cant-adapt.html > According to the first comment, you might do something wrong with the > arguments types. > Unless you give a table description (\d from psql shell) and the model > I'm not sure I can help you further. > > Regards, > Xavier. > > As the stack seems to have a > > Le 7 août 2010 à 17:21, Daniel França a écrit : > > I just created my db using django manage syncdb, I think it should > create right. > or how can I see the encode of each tables? > I'm using postgresql 8.4 > maybe I'll need reinstall everything =S > > On Sat, Aug 7, 2010 at 6:49 AM, Xavier Ordoquy > wrote: > >> >> Le 7 août 2010 à 06:44, Daniel França a écrit : >> >> > My database is UTF-8, it's fine, doesn't?. >> > I'm afraid to reinstall everything from ports and start to get a lot >> 64-32 bits incompatible issues like happened before =/ >> >> I think that should be fine with a utf-8 DB. >> Are you sure your tables are UTF-8 ? >> What database are you using ? mysql ? postgres ? I had no issue with >> both and I have a couple of non pure ascii sites. >> However, when I moved to snow leopard, I recompiled mysql/postgres and >> the python drivers. >> >> Regards, >> Xavier. >> >> -- >> 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. >> >> > > -- > 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. > > > > -- > You received this message bec
Re: Django on Mac OS X
2010/8/9 Daniel França : > I tried to reinstall everything... installing python+postgres from ports > and I get the Symbol not found: _PQbackendPID error again from psycopg. > I guess the best solution is run Ubuntu on a virtual machine or my project > will be stuck forever. > python+psycopg on mac just sux. I haven't really been following this thread, but you meant psycopg2, not psycopg right? psycopg is old and unsupported as far as I know. > > 2010/8/8 Daniel França >> >> tried, nothing :( >> I'm getting crazy with Mac OS, I think I'll go back to Linux :S >> >> On Sun, Aug 8, 2010 at 4:34 AM, Xavier Ordoquy >> wrote: >>> >>> It won't work by commenting the timezone field since it has been created >>> with a non null constraint on your db. >>> Have you tried to get_or_create the account with timezone and language >>> set to some value ? >>> Regards, >>> Xavier. >>> >>> Le 8 août 2010 à 04:09, Daniel França a écrit : >>> >>> More information. >>> here: >>> def create_account(sender, instance=None, **kwargs): >>> if instance is None: >>> return >>> account, created = Account.objects.get_or_create(user=instance) >>> post_save.connect(create_account, sender=User) >>> If I comment the post_save.connect, there's no exception =) but, of >>> course the code doesn't do what it should do. >>> So, I don't know why, but the error is in the connect... maybe because of >>> timezone attribute of user >>> anyone has any idea? >>> 2010/8/7 Daniel França Xavier, I think we are almost there :P because there's a timezone field in my account model: class Account(models.Model): user = models.ForeignKey(User, unique=True, verbose_name=_('user')) timezone = TimeZoneField(_('timezone')) language = models.CharField(_('language'), max_length=10, choices=settings.LANGUAGES, default=settings.LANGUAGE_CODE) def __unicode__(self): return self.user.username I tried to comment the line, but then the create_user abort with an constraint timezone error. On Sat, Aug 7, 2010 at 2:22 PM, Xavier Ordoquy wrote: > > And what's your Account model ? > I noticed it is in its get_or_create that you get the error. > Regards, > Xavier. > > Le 7 août 2010 à 18:52, Daniel França a écrit : > > Same error =/ > but now,I don't know why.. it's saving at the db. The error still > happens, but the data is in the database > > On Sat, Aug 7, 2010 at 12:54 PM, Xavier Ordoquy > wrote: >> >> Sorry, I just woke up form a sleep :) >> I notice you get-or-create a user. >> However, did you try to call get or create with specifying the >> arguments ? first_name = "...", and so on ? >> Does it still give an error ? >> Regards, >> Xavier. >> Le 7 août 2010 à 17:46, Xavier Ordoquy a écrit : >> >> I just googled your error and found: >> http://www.nerdydork.com/django-programmingerror-cant-adapt.html >> According to the first comment, you might do something wrong with the >> arguments types. >> Unless you give a table description (\d from psql shell) and the model >> I'm not sure I can help you further. >> Regards, >> Xavier. >> As the stack seems to have a >> Le 7 août 2010 à 17:21, Daniel França a écrit : >> >> I just created my db using django manage syncdb, I think it should >> create right. >> or how can I see the encode of each tables? >> I'm using postgresql 8.4 >> maybe I'll need reinstall everything =S >> >> On Sat, Aug 7, 2010 at 6:49 AM, Xavier Ordoquy >> wrote: >>> >>> Le 7 août 2010 à 06:44, Daniel França a écrit : >>> >>> > My database is UTF-8, it's fine, doesn't?. >>> > I'm afraid to reinstall everything from ports and start to get a >>> > lot 64-32 bits incompatible issues like happened before =/ >>> >>> I think that should be fine with a utf-8 DB. >>> Are you sure your tables are UTF-8 ? >>> What database are you using ? mysql ? postgres ? I had no issue with >>> both and I have a couple of non pure ascii sites. >>> However, when I moved to snow leopard, I recompiled mysql/postgres >>> and the python drivers. >>> >>> Regards, >>> Xavier. >>> >>> -- >>> 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. >>> >> >> >> -- >> 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 g
one inconsistent place between django document and source code.
Hi All, When I was reading django document, I also viewed the source code of the framework to help me understand, but I found one inconsistent place about urls attribute of Django's AdminSite object. # in djangoproject document, http://docs.djangoproject.com/en/dev/topics/http/urls/: ** This will include the nominated URL patterns into the given application and instance namespace. For example, the urls attribute of Django's AdminSite object returns a 3-tuple that contains all the patterns in an admin site, plus the name of the admin instance, and the application namespace admin. # in source code: /django/contrib/admin/options.py def urls(self): return self.get_urls() urls = property(urls) def get_urls(self): from django.conf.urls.defaults import patterns, url def wrap(view): def wrapper(*args, **kwargs): return self.admin_site.admin_view(view)(*args, **kwargs) return update_wrapper(wrapper, view) info = self.model._meta.app_label, self.model._meta.module_name urlpatterns = patterns('', url(r'^$', wrap(self.changelist_view), name='%s_%s_changelist' % info), url(r'^add/$', wrap(self.add_view), name='%s_%s_add' % info), url(r'^(.+)/history/$', wrap(self.history_view), name='%s_%s_history' % info), url(r'^(.+)/delete/$', wrap(self.delete_view), name='%s_%s_delete' % info), url(r'^(.+)/$', wrap(self.change_view), name='%s_%s_change' % info), ) return urlpatterns -- 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: Customizing django admin
there are 2 ways you can do, both are very easy: 1st: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#custom-template-options 2nd: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates On Aug 9, 10:18 am, vishy wrote: > Hi, > > For a modeladmin,I need to show a custom template when user adds or > edits.How can I go about implementing this functionality? > > thanks -- 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.