If I understand correctly, you can't create a User without defining a
SoldService at the same time?
Can't reproduce this behaviour. Which version of Django are you using?

Nuno

2010/4/7 onorua <ono...@gmail.com>:
> Hello colleagues,
>
> I have the models.py:
> class User(models.Model):
>    LastName = models.CharField(max_length=50, verbose_name =
> "Фамилия")
>    FirstName = models.CharField(max_length=50, verbose_name = "Имя")
>    MidleName = models.CharField(max_length=50, verbose_name =
> "Отчество")
>
> class SoldServices(models.Model):
>    state_choices = (
>        ('ACT', u'Активно'),
>        ('PAS', u'Пасивно'),
>        ('TRM', u'Отключено'),
>        )
>    Service = models.ForeignKey('Service', verbose_name = 'Услуга')
>    User = models.ForeignKey('User', blank=True, null=True,
> verbose_name = 'Пользователь', related_name='SoldService')
>    ValidFrom = models.DateTimeField(default=datetime.today(),
> verbose_name = u"Активный с")
>    ValidTo = models.DateTimeField(verbose_name = u"Активный до")
>    State = models.CharField(default='ACT', max_length=3, choices =
> state_choices , verbose_name="Состояние")
>
> admin.py:
> class SoldServicesInline(admin.TabularInline):
>    model = SoldServices
>
> class UserAdmin(admin.ModelAdmin):
>    inlines = [SoldServicesInline]
>
> When I'm trying to save the User model with Admin interface, it
> through an error like Service and ValidTo should be set for all non
> filled feelds in inline form.
> How can I prevent this behavior? I need possibility to add new inlines
> (I can't set extra=0), but I don't want to add this every time, and
> this behavior looks strange to me.
> When I change to blank=True, null=True, it create blank Sold services
> as soon as I save the User which is not acceptable also.
>
> --
> 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.

Reply via email to