Newforms-admin: querysets for inlines?
Hi, Studying the new features in the newform admin, querysets give great control over which instances will be shown. I wonder if it is/will be possible to restrict inline fields (on a foreign key) in a similar way? Also, there is a ticket for 'classes': 'collapse' in newforms-admin ( ticket #5631), will this be supported at some point? Thanks a lot, the new features are way beyond exciting, Rob --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Add/change detail pages will throw an exception, newforms-admin, svn version 6407
Super, in today's version (r6424) of newforms-admin the 2nd issue has also been resolved! From the ticket trail I'm not sure if this is the final resolution, but it sure works again. Thanks for all the hard work, Rob On Sep 22, 2007, at 11:01 AM, Rob J Goedman wrote: > Hi Russ, > > Did test the json based fixture problem. Initially I continued to > have problems until I actually cleaned up the database itself. > Tricky! But now it is working fine! Thanks a lot. > > In testing the fix for the 1st problem this morning, I did notice > the 2nd problem is still there. A further observation seems to be > that add/change detail forms work for simple list pages, e.g. > Groups but fail for most, e.g.Users. > > Regards, > Rob > > >> On Sep 22, 2007, at 6:26 AM, Russell Keith-Magee wrote: >>> >>> On 9/20/07, Tomasz Melcer <[EMAIL PROTECTED]> wrote: >>>> >>>> On 19 Wrz, 16:37, Rob J Goedman <[EMAIL PROTECTED]> wrote: >>>>> Tomasz, >>>>> >>>>> The fixture is breaking with ' "2007-09-17 09:17:57.890755", ', >>>>> after >>>>> revision 6329 it either >>>>> started to add the subseconds or can't read them anymore. Not >>>>> sure if >>>>> there are more instances >>>>> of such a time format. Remove the .nn part to fix it. >>> >>> FYI - this problem has been fixed in trunk in [6406]. It will be in >>> newforms-admin the next time that branch is merged. > > On Sep 16, 2007, at 12:56 PM, Rob J Goedman wrote: >> Hi, >> >> Today's version shows 2 problems, the first problem is related to >> date/time formats in fixtures, the 2nd to at least add forms, >> e.g. add users. Both using the newform-admin branch. >> >> The 1st problem can be created by installing a brand new project, >> creating an initial_data.json file and run ./manage syncdb again >> (or ./manage loaddata initial_data.json): > > ... > >> The 2nd problem, also testable in a brand new project, e.g. trying >> to add a user: >> >> TypeError at /admin/auth/user/add/ >> instancemethod expected at least 2 arguments, got 0 >> >> Request Method: >> GET >> Request URL: >> http://localhost:8000/admin/auth/user/add/ >> Exception Type: >> TypeError >> Exception Value: >> instancemethod expected at least 2 arguments, got 0 >> Exception Location: >> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ >> copy_reg.py in __newobj__, line 92 >> Python Executable: >> /Library/Frameworks/Python.framework/Versions/2.5/Resources/ >> Python.app/Contents/MacOS/Python >> Python Version: >> 2.5.1 >> Traceback (innermost last) >> >> Switch to copy-and-paste view >> >> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ >> site-packages/django/core/handlers/base.py in _real_get_response >> response = callback(request, *callback_args, >> **callback_kwargs) >> ... >> ▶ Local vars --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Add/change detail pages will throw an exception, newforms-admin, svn version 6407
Hi Russ, Did test the json based fixture problem. Initially I continued to have problems until I actually cleaned up the database itself. Tricky! But now it is working fine! Thanks a lot. In testing the fix for the 1st problem this morning, I did notice the 2nd problem is still there. A further observation seems to be that add/change detail forms work for simple list pages, e.g. Groups but fail for most, e.g.Users. Regards, Rob > On Sep 22, 2007, at 6:26 AM, Russell Keith-Magee wrote: >> >> On 9/20/07, Tomasz Melcer <[EMAIL PROTECTED]> wrote: >>> >>> On 19 Wrz, 16:37, Rob J Goedman <[EMAIL PROTECTED]> wrote: >>>> Tomasz, >>>> >>>> The fixture is breaking with ' "2007-09-17 09:17:57.890755", ', >>>> after >>>> revision 6329 it either >>>> started to add the subseconds or can't read them anymore. Not >>>> sure if >>>> there are more instances >>>> of such a time format. Remove the .nn part to fix it. >> >> FYI - this problem has been fixed in trunk in [6406]. It will be in >> newforms-admin the next time that branch is merged. On Sep 16, 2007, at 12:56 PM, Rob J Goedman wrote: > Hi, > > Today's version shows 2 problems, the first problem is related to > date/time formats in fixtures, the 2nd to at least add forms, > e.g. add users. Both using the newform-admin branch. > > The 1st problem can be created by installing a brand new project, > creating an initial_data.json file and run ./manage syncdb again > (or ./manage loaddata initial_data.json): ... > The 2nd problem, also testable in a brand new project, e.g. trying > to add a user: > > TypeError at /admin/auth/user/add/ > instancemethod expected at least 2 arguments, got 0 > > Request Method: > GET > Request URL: > http://localhost:8000/admin/auth/user/add/ > Exception Type: > TypeError > Exception Value: > instancemethod expected at least 2 arguments, got 0 > Exception Location: > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > copy_reg.py in __newobj__, line 92 > Python Executable: > /Library/Frameworks/Python.framework/Versions/2.5/Resources/ > Python.app/Contents/MacOS/Python > Python Version: > 2.5.1 > Traceback (innermost last) > > Switch to copy-and-paste view > > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > site-packages/django/core/handlers/base.py in _real_get_response > response = callback(request, *callback_args, > **callback_kwargs) > ... > ▶ Local vars --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py dumpdata && loaddata -- problem with datetime fields
Hi Russ, Yes, I use Postgres 8.2.3 on Mac OS. I think reverting back to revision 6329 fixes this problem as well. Date/time stamps are then neatly written with just :SS (not as HH:MM:SS.123456). Hope this helps, thank you (and all other developers) for such a great framework! Rob On Sep 17, 2007, at 8:06 AM, Russell Keith-Magee wrote: > > On 9/17/07, Rob J Goedman <[EMAIL PROTECTED]> wrote: >> >> This is the same problem as I found earlier and below steps will >> reproduce it and with an empty project (no log_entries etc, just 1 >> superuser) it is fixed by removing the subseconds. > > Ok - thanks for that. I can reproduce this problem with SQLite, but > not with Postgres. Does this concur with your experience? > > The really strange thing is that I'm not seeing any failures in the > serialization regression tests this will require some digging. > > 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Today's newform-admin branch, svn version 6364
Reverting to 6329 will fix it. Must have gotten introduced during the merge to 6332. Regards, Rob On Sep 17, 2007, at 6:18 AM, AndyB wrote: > On Sep 16, 8:56 pm, Rob J Goedman <[EMAIL PROTECTED]> wrote: >> Hi, >> >> Today's version shows 2 problems, the first problem is related to >> date/time formats in fixtures, the 2nd to at least add forms, >> e.g. add users. Both using the newform-admin branch. >> >> The 1st problem can be created by installing a brand new project, >> creating an initial_data.json file and run ./manage syncdb again >> (or ./manage loaddata initial_data.json): >> >> Robs-Intel:~/Projects/o2o/mcp rob$ ./manage.py syncdb >> ... >> Installing index for auth.Message model >> Installing index for auth.Permission model >> Installing index for admin.LogEntry model >> Loading 'initial_data' fixtures... >> Installing json fixture 'initial_data' from absolute path. >> Problem installing fixture 'initial_data.json': [u'Enter a valid >> date/ >> time in -MM-DD HH:MM format.'] >> >> Looking at the initial_data.json file I think it complains about >> timestamps such as '2007-09-16 12:34:51.765432'. Removing the sub- >> second parts fixes it, it accepts a :SS component. This happen in >> user and some other fixture json records (e.g. log_entries). >> --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py dumpdata && loaddata -- problem with datetime fields
This is the same problem as I found earlier and below steps will reproduce it and with an empty project (no log_entries etc, just 1 superuser) it is fixed by removing the subseconds. Regards, Rob On Sep 16, 8:56 pm, Rob J Goedman <[EMAIL PROTECTED]> wrote: > Hi, > > Today's version shows 2 problems, the first problem is related to > date/time formats in fixtures, the 2nd to at least add forms, > e.g. add users. Both using the newform-admin branch. > > The 1st problem can be created by installing a brand new project, > creating an initial_data.json file and run ./manage syncdb again > (or ./manage loaddata initial_data.json): > > Robs-Intel:~/Projects/o2o/mcp rob$ ./manage.py syncdb > ... > Installing index for auth.Message model > Installing index for auth.Permission model > Installing index for admin.LogEntry model > Loading 'initial_data' fixtures... > Installing json fixture 'initial_data' from absolute path. > Problem installing fixture 'initial_data.json': [u'Enter a valid date/ > time in -MM-DD HH:MM format.'] > > Looking at the initial_data.json file I think it complains about > timestamps such as '2007-09-16 12:34:51.765432'. Removing the sub- > second parts fixes it, it accepts a :SS component. This happen in > user and some other fixture json records (e.g. log_entries). ... On Sep 17, 2007, at 7:21 AM, Tomasz Melcer wrote: > > On 17 Wrz, 15:16, "Russell Keith-Magee" <[EMAIL PROTECTED]> > wrote: >> We have a fairly extensive unit test suite around serialization >> formats; as a result, I'm not aware of any problems of this sort. >> >> Can you provide a minimal example that reproduces this problem? i.e., >> can you provide an example model and a JSON data fixture that >> can't be >> loaded? > Sure. > > The testcase (a bash script) is at http://dpaste.com/hold/19852/ > Run it by invoking: > DJANGO_LOC=path-to-django-working-copy ./testcase > And enter some data when asked by manage.py (answering "yes" to first > question). I couldn't make the script answer these questions > automatically, because manage.py is calling ioctls. The script will > make a project from scratch, using a temporary database in /tmp. > > My output is at http://dpaste.com/hold/19854/ > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Today's newform-admin branch, svn version 6364
Hi, Today's version shows 2 problems, the first problem is related to date/time formats in fixtures, the 2nd to at least add forms, e.g. add users. Both using the newform-admin branch. The 1st problem can be created by installing a brand new project, creating an initial_data.json file and run ./manage syncdb again (or ./manage loaddata initial_data.json): Robs-Intel:~/Projects/o2o/mcp rob$ ./manage.py syncdb ... Installing index for auth.Message model Installing index for auth.Permission model Installing index for admin.LogEntry model Loading 'initial_data' fixtures... Installing json fixture 'initial_data' from absolute path. Problem installing fixture 'initial_data.json': [u'Enter a valid date/ time in -MM-DD HH:MM format.'] Looking at the initial_data.json file I think it complains about timestamps such as '2007-09-16 12:34:51.765432'. Removing the sub- second parts fixes it, it accepts a :SS component. This happen in user and some other fixture json records (e.g. log_entries). The 2nd problem, also testable in a brand new project, e.g. trying to add a user: TypeError at /admin/auth/user/add/ instancemethod expected at least 2 arguments, got 0 Request Method: GET Request URL: http://localhost:8000/admin/auth/user/add/ Exception Type: TypeError Exception Value: instancemethod expected at least 2 arguments, got 0 Exception Location: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ copy_reg.py in __newobj__, line 92 Python Executable: /Library/Frameworks/Python.framework/Versions/2.5/Resources/ Python.app/Contents/MacOS/Python Python Version: 2.5.1 Traceback (innermost last) Switch to copy-and-paste view /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/django/core/handlers/base.py in _real_get_response response = callback(request, *callback_args, **callback_kwargs) ... ▶ Local vars Regards, Rob --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
User detail page in brand new project
Hi, Using today's newform-admin (rev 6098) I consistently get the below exception, even with a brand new project initialized with ./manage syncdb, including a superuser. List page shows User, detail page creates exception. Hadn't tried this in a while so I am not sure if it has been there a bit longer. My own tables produce this message when I forget to change 'fields' into 'fieldsets' in the Admin class. Thanks, Rob KeyError at /admin/auth/user/1/ 'Key None not found in Form' Request Method: GET Request URL: http://localhost:8000/admin/auth/user/1/ Exception Type: KeyError Exception Value: 'Key None not found in Form' Exception Location: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/django/newforms/forms.py in __getitem__, line 93 Python Executable: /Library/Frameworks/Python.framework/Versions/2.5/Resources/ Python.app/Contents/MacOS/Python Python Version: 2.5.1 Template error In template /Library/Frameworks/Python.framework/Versions/Current/lib/ python2.5/site-packages/django/contrib/admin/templates/admin/ change_form.html, error at line 43 Caught an exception while rendering: 'Key None not found in Form' 33 {% block form_top %}{% endblock %} 34 35 {% if is_popup %}{% endif %} 36 {% if save_on_top %}{% submit_row %}{% endif %} 37 {% if adminform.form.errors %} 38 39 {% blocktrans count adminform.form.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} 40 41 {% endif %} 42 43 {% for fieldset in adminform %} 44 45 {% if fieldset.name %}{{ fieldset.name }}{% endif %} 46 {% if fieldset.description %} {{ fieldset.description }}{% endif %} 47 {% for line in fieldset %} 48 49 {{ line.errors }} 50 {% for field in line %} 51 {% if field.is_checkbox %} 52 {{ field.field }}{{ field.label_tag }} 53 {% else %} --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Generic login view bug suspection
Thanks a lot, this answers my question from a couple of days as well! It works again! Rob On Apr 19, 2007, at 8:05 AM, James Bennett wrote: > > On 4/19/07, mojo <[EMAIL PROTECTED]> wrote: >> I think this might be a bug. Unexpected behaviour at least. >> When I delete default Site object ('example.com'), generic login >> view raises >> exception, as it is looking for Site with pk=1. > > We really need to document this a little better; if you delete that > Site object, you'll have to create a new one and change the SITE_ID > setting in your settings file to match the id of that new object, > because lots of things use that to look up site-specific content. > > The preferred method is simply to edit the default Site object to have > the correct domain name. On Apr 17, 2007, at 10:27 AM, Rob J Goedman wrote: > Hi, > > In Django version 0.97-pre, rev 5020, I'm adding additional views > for end users, all decorated with @login_required. > > I noticed if I'm not already logged in (by 1st visiting .../ > admin/), I get below error (reproduced in a python terminal, same > problem as in a browser - [17/Apr/2007 10:22:43] "GET /accounts/ > login/?next=/GUI/start/ HTTP/1.1" 500 51242 gives: > > DoesNotExist at /accounts/login/ > Site matching query does not exist. > > Request Method: > GET > Request URL: > http://localhost:8000/accounts/login/ > Exception Type: > DoesNotExist > Exception Value: > Site matching query does not exist. > Exception Location: > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > site-packages/django/db/models/query.py in get, line 252 > > ). --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Q on when Site.objects.get_current() can fail
Hi, In Django version 0.97-pre, rev 5020, I'm adding additional views for end users, all decorated with @login_required. I noticed if I'm not already logged in (by 1st visiting .../admin/), I get below error (reproduced in a python terminal, same problem as in a browser - [17/Apr/2007 10:22:43] "GET /accounts/login/?next=/GUI/ start/ HTTP/1.1" 500 51242 gives: DoesNotExist at /accounts/login/ Site matching query does not exist. Request Method: GET Request URL: http://localhost:8000/accounts/login/ Exception Type: DoesNotExist Exception Value: Site matching query does not exist. Exception Location: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/django/db/models/query.py in get, line 252 ). Removing the decorator and including or not 'django.contrib.sites' in INSTALLED_APPS seems to make no difference. Any hints what I'm doing wrong? I hadn't tested this for a while, but 2 months ago I'm sure this worked fine. Thanks, Rob >>> from django.conf import settings >>> settings.SITE_ID 1 >>> Site.objects.all() [] >>> Site.objects.get_current() Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/django/contrib/sites/models.py", line 7, in get_current return self.get(pk=settings.SITE_ID) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/django/db/models/manager.py", line 73, in get return self.get_query_set().get(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/django/db/models/query.py", line 252, in get raise self.model.DoesNotExist, "%s matching query does not exist." % self.model._meta.object_name django.db.models.base.DoesNotExist: Site matching query does not exist. >>> --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Unique_together question
Thanks Ramiro, Thanks for the pointer and hint. Next time I will search there first. That indeed gets it through the validator. The error seems to be caught by some lower level (db?), but for now that works. Thanks again, Rob On Mar 11, 2007, at 4:45 PM, Ramiro Morales wrote: > > On 3/11/07, Rob J Goedman <[EMAIL PROTECTED]> wrote: > >> >> Any reason I can't combine these 2 fields to get a valid >> 'isUniqueday_sch' >> in the AddManipulator? Full traceback at the end of the email. >> > > This is a problem already reported. See tickets #526 and #2470, > there is a > workaround described in the comments that involves changing the > order of the > fields in unique_together. > > Regards, > > -- > Ramiro Morales > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Unique_together question
Earlier I noticed the problem with edit_inline which is now fixed in svn. By the way, this was the very 1st time in 5 months a daily sync with svn caused an issue. Hats off to the developers! As I mentioned, I am trying to make 'day' and 'sch' unique_together in class ScheduleDayOfTheWeek. Any reason I can't combine these 2 fields to get a valid 'isUniqueday_sch' in the AddManipulator? Full traceback at the end of the email. Thanks, Rob On Mar 9, 2007, at 2:14 PM, Rob J Goedman wrote: > Hi, > > If I upgrade to revision 4693 (or higher) I get below error. > Revision 4692 works fine. > > Any hints? I did start to play with unique_together earlier today > when I noticed it, > but don't think that's the reason. It's currently (and has been for > several months) > commented out. > > Another small issue, if I try to make an IP address field and port > number 'unique_together' > Django creates an exception with a hint to insert a typecast. It's > not clear to me where to > do that. My workaround is simply to use CharField for the IP address. > > Thanks, > Rob > > -- > -- > > The models are: > > class Schedule(models.Model): > """The Schedule class.""" > > name = models.CharField(maxlength=40, unique=True) > sch_excs = models.ManyToManyField(ScheduleHolidayException, > null=True, blank=True, > filter_interface=models.HORIZONTAL) > > def __str__(self): > return self.name > > def employees(self): > return 'Employees' % > self.id > employees.allow_tags = True > > class Admin: > fields = ( > ('Name', {'fields': ('name',), }), > ('Holiday exceptions', {'fields': > ('sch_excs',), 'classes' : > 'collapse'}), > ) > list_display = ('__str__', 'employees') > save_on_top = True > > class Meta: > db_table = 'sch' > > > class ScheduleDayOfTheWeek(models.Model): > """Access times at days of the weeks > """ > > day_choices = ( > ('0', 'Sunday'), > ('1', 'Monday'), > ('2', 'Tuesday'), > ('3', 'Wednesday'), > ('4', 'Thursday'), > ('5', 'Friday'), > ('6', 'Saturday') > ) > > day = models.CharField(maxlength=1, choices=day_choices) > sch = models.ForeignKey(Schedule, edit_inline=models.TABULAR, > num_in_admin=7, min_num_in_admin=7, max_num_in_admin=7) > start_time = models.TimeField(core=True, default = datetime.time > (0, 0, 0)) > end_time = models.TimeField(core=True, default = datetime.time(0, > 0, 0)) > > def __str__(self): > return self.day + ' of schedule ' + self.sch.name > > class Meta: > unique_together = (('day', 'sch'),) > ordering = ('day',) > db_table = 'sch_dow' > verbose_name_plural = 'Days of the week in schedules' > AttributeError at /admin/Application_Settings/schedule/add/ 'AddManipulator' object has no attribute 'isUniqueday_sch' Request Method: GET Request URL: http://localhost:8000/admin/Application_Settings/schedule/add/ Exception Type: AttributeError Exception Value: 'AddManipulator' object has no attribute 'isUniqueday_sch' Exception Location: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/django/db/models/fields/__init__.py in get_manipulator_fields, line 239 Traceback (innermost last) Switch to copy-and-paste view /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/django/core/handlers/base.py in get_response response = callback(request, *callback_args, **callback_kwargs) ... ▶ Local vars /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/django/contrib/admin/views/decorators.py in _checklogin return view_func(request, *args, **kwargs) ... ▶ Local vars /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/django/views/decorators/cache.py in _wrapped_view_func response = view_func(request, *args, **kwargs) ... ▶ Local vars /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/django/contrib/admin/views/main.py in add_stage manipulator = model.AddManipulator() ... ▶ Local vars /Library/Frameworks/Python.fra
Re: Tutorial part 2, Problem with edit_inline
Thanks James, The slightly earlier message by Rotlaus points to the same issue. Rotlaus, If you are using svn, doing an ' svn -r 4692 up ' in the django_src dir followed by ' python setup.py install ' will make the model work. Rob On Mar 9, 2007, at 2:39 PM, James Bennett wrote: > > On 3/9/07, Rob J Goedman <[EMAIL PROTECTED]> wrote: >> If I upgrade to revision 4693 (or higher) I get below error. >> Revision 4692 >> works fine. > > I need to do some digging to see what's up with that; it's definitely > the changeset, not your code. On Mar 9, 2007, at 2:02 PM, Rotlaus wrote: > Sorry for the maybe dumb question, but i'm new to python and django. > I#M just following th tutorial and have a problem at part 2 of it. > When adding the edit_inline parameter to the poll foreign key as > stated in the tutorial i get this error message: > > KeyError at /admin/polls/poll/1/ > "Could not find Formfield or InlineObjectCollection named > 'polls_choice'" > Request Method: GET > Request URL: http://127.0.0.1:8000/admin/polls/poll/1/ > Exception Type: KeyError > Exception Value: "Could not find Formfield or InlineObjectCollection > named 'polls_choice'" > Exception Location: /usr/lib/python2.5/site-packages/django/oldforms/ > __init__.py in __getitem__, line 135 --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Inline incompatibility/issue?
Hi, If I upgrade to revision 4693 (or higher) I get below error. Revision 4692 works fine. Any hints? I did start to play with unique_together earlier today when I noticed it, but don't think that's the reason. It's currently (and has been for several months) commented out. Another small issue, if I try to make an IP address field and port number 'unique_together' Django creates an exception with a hint to insert a typecast. It's not clear to me where to do that. My workaround is simply to use CharField for the IP address. Thanks, Rob The models are: class Schedule(models.Model): """The Schedule class.""" name = models.CharField(maxlength=40, unique=True) sch_excs = models.ManyToManyField(ScheduleHolidayException, null=True, blank=True, filter_interface=models.HORIZONTAL) def __str__(self): return self.name def employees(self): return 'Employees' % self.id employees.allow_tags = True class Admin: fields = ( ('Name', {'fields': ('name',), }), ('Holiday exceptions', {'fields': ('sch_excs',), 'classes' : 'collapse'}), ) list_display = ('__str__', 'employees') save_on_top = True class Meta: db_table = 'sch' class ScheduleDayOfTheWeek(models.Model): """Access times at days of the weeks """ day_choices = ( ('0', 'Sunday'), ('1', 'Monday'), ('2', 'Tuesday'), ('3', 'Wednesday'), ('4', 'Thursday'), ('5', 'Friday'), ('6', 'Saturday') ) day = models.CharField(maxlength=1, choices=day_choices) sch = models.ForeignKey(Schedule, edit_inline=models.TABULAR, num_in_admin=7, min_num_in_admin=7, max_num_in_admin=7) start_time = models.TimeField(core=True, default = datetime.time(0, 0, 0)) end_time = models.TimeField(core=True, default = datetime.time(0, 0, 0)) def __str__(self): return self.day + ' of schedule ' + self.sch.name class Meta: # unique_together = (('day', 'sch'),) ordering = ('day',) db_table = 'sch_dow' verbose_name_plural = 'Days of the week in schedules' KeyError at /admin/Application_Settings/schedule/15/ "Could not find Formfield or InlineObjectCollection named 'Application_Settings_scheduledayoftheweek'" Request Method: GET Request URL: http://localhost:8000/admin/Application_Settings/schedule/15/ Exception Type: KeyError Exception Value: "Could not find Formfield or InlineObjectCollection named 'Application_Settings_scheduledayoftheweek'" Exception Location: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/django/oldforms/__init__.py in __getitem__, line 135 Template error In template /Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/django/contrib/admin/templates/admin/ change_form.html, error at line 57 Caught an exception while rendering: "Could not find Formfield or InlineObjectCollection named 'Application_Settings_scheduledayoftheweek'" 47 {% block after_field_sets %}{% endblock %} 48 {% if change %} 49 {% if ordered_objects %} 50 {% trans "Ordering" %} 51 52 {% if form.order_.errors %}{{ form.order_.html_error_list }}{% endif %} 53 {% trans "Order:" %} {{ form.order_ }} 54 55 {% endif %} 56 {% endif %} 57 {% for related_object in inline_related_objects %}{% edit_inline related_object %}{% endfor %} 58 {% block after_related_objects %}{% endblock %} 59 {% submit_row %} 60 {% if add %} 61 document.getElementById ("{{ first_form_field_id }}").focus(); 62 {% endif %} 63 {% if auto_populated_fields %} 64 65 {% auto_populated_field_script auto_populated_fields change %} 66 67 {% endif %} --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
FC5/modpython/Django0.96pre
Hi, A project, developed on OSX, needs to be moved to FC5, headless. ./ manage.py runserver works fine. But behind Apache 2.2/mod_python I get below error. FC5 does use python 2.4.3 (on OSX I use python2.5). Any hint where I should be looking. If I modify settings so it does not find the templates, it does show the contents of the normal admin pages, but of course as a list. So it looks the mod_python works, etc. With debug=True below page is shown with {% block stylesheet %} highlighted. Thanks, Rob TypeError at /mcp/admin/ sequence item 1: expected string, tuple found Request Method: GET Request URL:http://10.0.1.3/mcp/admin/ Exception Type: TypeError Exception Value:sequence item 1: expected string, tuple found Exception Location: /usr/lib/python2.4/site-packages/django/template/ __init__.py in render, line 697 Template error In template /usr/lib/python2.4/site-packages/django/contrib/admin/ templates/admin/base.html, error at line 5 Caught an exception while rendering: sequence item 1: expected string, tuple found 1 2 http://www.w3.org/1999/xhtml; lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}> 3 4 {% block title %}{% endblock %} 5 6 {% if LANGUAGE_BIDI %}{% endif %} 7 {% block extrastyle %}{% endblock %} 8 {% block extrahead %}{% endblock %} 9 {% block blockbots %} {% endblock %} 10 11 {% load i18n %} 12 13 14 15 Traceback (innermost last) Switch to copy-and-paste view /usr/lib/python2.4/site-packages/django/template/__init__.py in render_node result = node.render(context) ... ▶ Local vars /usr/lib/python2.4/site-packages/django/template/loader_tags.py in render result = self.nodelist.render(context) ... ▶ Local vars /usr/lib/python2.4/site-packages/django/template/__init__.py in render return ''.join(bits) ... ▶ Local vars ... --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newbie question
Thanks a lot Honza and James! On Jan 13, 2007, at 1:35 PM, Honza Král wrote: just a thought: do you have DEBUG turned off in your settings? if not, django will store all qeuries it made in memory so that it is accessible for debugging purposes... That's it! With debug off it's stable! Super. On Jan 13, 2007, at 1:37 PM, James Bennett wrote: On 1/13/07, Rob J Goedman <[EMAIL PROTECTED]> wrote: Normally the delays are natural and are controlled via Twisted (TCP and callLater). Above program is stable if I comment out the cpl=list (...) statement, otherwise it grows forever. Each time that code is called, it's fetching every row from the table and instantiating a full in-memory model object for each row retrieved; is there a reason why you need to have them all loaded and instantiated at that moment, rather than waiting and iterating over the QuerySet when you actually need to access the data? In the actual code I do indeed iterate over query sets. Initially I hadn't realized this but I noticed changing a panel to enable did not get picked up. So I do not to force a refresh from the db each time around. Luckily there are a limited set of control panels (<32 typically). Thanks for the very quick answers!! Rob --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Newbie question
Hi, We converted an access system written in VB to a Django app. The pure db side and GUI work great. Data is also obtained from control panels that have fingerprint readers attached. So I wrote a separate python program to 'scan' these control panels (embedded linux based) and store it in Django models/postgres tables. I noticed that I have a memory leak. Tried anything I can think of. I stripped out all useful parts (it uses twisted and some other stuff, but those are not the problem). The problem is that below small (useless) program grows eternally (well in this example until i=1000). I do need to refresh the cpl model in the loop every few seconds, i.e. using admin or views control panels can be enabled or disabled or change IP address, etc. import gc, mcp.settings from mcp.Control_Panels.models import ControlPanel for i in range(1, 1000): cpl = list(ControlPanel.objects.all()) for j in range(1, 100): j += 1 if i % 10 == 0: print '.' # gc.collect() Normally the delays are natural and are controlled via Twisted (TCP and callLater). Above program is stable if I comment out the cpl=list (...) statement, otherwise it grows forever. I run on several Macs (ppc and intel), latest Mac OS, latest svn version of Django, Postgres 8.2.0 and psycopg2-2.0.5.1. We have also seen this behavior on FC5. Has anyone used Django/psycopg in a similar setting? I could try just psycopg, not to hard in this example, but less elegant with the real set of o2o, m2m and fk models. Thanks, Rob --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---