Le 2 mai 2011 à 11:49, Nick a écrit : > Hi, > > I'm having a very strange problem with a site I've developed, which > only seems to happen when DEBUG=False and is now preventing my from > launching the site (unless I launch it in DEBUG mode, which I > obviously don't want to). The EXACT same code works in DEBUG=True, > but with DEBUG=False I get the following error when trying to access > one of my ManyToMany fields: > > views.py - FieldError: Cannot resolve keyword 'page' into field. > Choices are: bank_holidays, date_values, finish, id, start, values, > year > > I have discovered that if I comment out my admin.autodiscover() line > in urls.py it suddenly starts working again. I've therefore looked at > my admin.py and simplified it to a very basic example, but this still > doesn't work. Here are the relevant parts of my code (let me know if > there are any other parts that would be useful to see)... > > models.py: http://dpaste.com/hold/537990/ > views.py: http://dpaste.com/537991/ > admin.py: http://dpaste.com/hold/537993/
Hi # some logic which populates the "page" variable with a Page object This comments make me thinks that you created a new Page object but did not save it. Can you confirm the page object has an id before doing page.years.all() ? 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-users@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.