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 '<a href="/schedule/%s/employees">Employees</a>' %
> 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.framework/Versions/2.5/lib/python2.5/site-
packages/django/db/models/manipulators.py in __init__
self.fields.extend(f.get_manipulator_fields
(self.opts, self, self.change, fol))
...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
packages/django/db/models/related.py in get_manipulator_fields
name_prefix=prefix, rel=True))
...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
packages/django/db/models/fields/__init__.py in get_manipulator_fields
params['validator_list'].append(getattr(manipulator,
'isUnique%s' % '_'.join(field_name_list)))
...
▼ Local vars
Variable
Value
change
False
field_name_list
('day', 'sch')
field_objs
[<class 'django.oldforms.SelectField'>]
follow
True
manipulator
<django.db.models.manipulators.AddManipulator object at 0x1745bf0>
name_prefix
'scheduledayoftheweek.0.'
opts
<Options for ScheduleDayOfTheWeek>
params
{'choices': [('', '---------'), ('0', 'Sunday'), ('1', 'Monday'),
('2', 'Tuesday'), ('3', 'Wednesday'), ('4', 'Thursday'), ('5',
'Friday'), ('6', 'Saturday')], 'validator_list': []}
rel
True
self
<django.db.models.fields.CharField object at 0x138ad50>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---