Any idea ? [EMAIL PROTECTED] wrote:
> > Hello, > > For one of my models, I did the following thing : > > """ > Civil state > """ > > class Civilstate(models.Model): > CIVILITY_CHOICES = ( > ('single', 'C�libataire'), > ('taken', 'Mari�'), > ) > who = models.ForeignKey(User, unique=True, > verbose_name='Personne', edit_inline=models.STACKED, num_in_admin=1, > max_num_in_admin=1) > photo = models.ImageField('Photo', height_field=80, > width_field=80, upload_to="photos", blank=True) > street = models.CharField('Adresse 1', maxlength=100, core=True) > street_bis = models.CharField('Adresse 2', maxlength=100, > core=True, blank=True) > zipcode = models.IntegerField('Code postal', maxlength=5, > core=True) > city = models.CharField('Ville', maxlength=100, core=True) > phone = models.CharField('T�l�hone', maxlength=20, core=True) > mobile = models.CharField('Portable', maxlength=20, core=True, > blank=True) > civility = models.CharField('Statut matrimonial', maxlength=20, > choices=CIVILITY_CHOICES, core=True) > birthdate = models.DateField('Date de naissance', core=True) > children = models.IntegerField('Nombre d\'enfants', core=True, > blank=True) > > def __str__(self): > return self.city > > class Admin: > list_display = ('who',) > list_filter = ['who',] > search_fields = ['who',] > > class Meta: > verbose_name = "Etat civil" > verbose_name_plural = "Etats civils" > > > When I edit the form in Django admin (running vanillia 0.96 version) > in a standalone mode, it works well. When I edit and save from "User" > form and if it's empty, it fails with the following traceback which I > do not understand : > > Traceback (most recent call last): > File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" > in get_response > 77. response = callback(request, *callback_args, **callback_kwargs) > File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/ > decorators.py" in _checklogin > 55. return view_func(request, *args, **kwargs) > File "/usr/lib/python2.5/site-packages/django/views/decorators/ > cache.py" in _wrapped_view_func > 39. response = view_func(request, *args, **kwargs) > File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/ > main.py" in change_stage > 329. new_object = manipulator.save(new_data) > File "/usr/lib/python2.5/site-packages/django/db/models/ > manipulators.py" in save > 165. if rel_new_data[related.opts.pk.name][0]: > > IndexError at /admin/auth/user/1/ > string index out of range > > If I fullfil the form in a standalone mode and then try to edit and > save it from User form, I have the following traceback : > > Traceback (most recent call last): > File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" > in get_response > 77. response = callback(request, *callback_args, **callback_kwargs) > File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/ > decorators.py" in _checklogin > 55. return view_func(request, *args, **kwargs) > File "/usr/lib/python2.5/site-packages/django/views/decorators/ > cache.py" in _wrapped_view_func > 39. response = view_func(request, *args, **kwargs) > File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/ > main.py" in change_stage > 329. new_object = manipulator.save(new_data) > File "/usr/lib/python2.5/site-packages/django/db/models/ > manipulators.py" in save > 172. if f.core and not isinstance(f, FileField) and > f.get_manipulator_new_data(rel_new_data, rel=True) in (None, ''): > File "/usr/lib/python2.5/site-packages/django/db/models/fields/ > __init__.py" in get_manipulator_new_data > 289. return new_data.get(self.name, [self.get_default()])[0] > > TypeError at /admin/auth/user/1/ > 'int' object is unsubscriptable > > If I remove the edit_inline propertie, User form works well. > > Any idea ? > > Regards, > Nicolas > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---