Hi,
-- I've run into interesting issue and I'm not sure if I do something wrong or this is Django issue. I'm using Multi Table Inheritance:
<code>
from django.db import models
from django import forms
class AccountType(models.Model):
users = models.ManyToManyField('auth.User', related_name='accounts')
class AccountTypeA(AccountType):
name = models.CharField(max_length=255)
class AccountTypeAForm(forms.ModelForm):
class Meta:
model = AccountTypeA
fields = ('name', 'users')
</code>
However, users are not saved in database. Find out that ModelForm calls `self.instance.users = <list-of-users>` but that's not get saved. Even
<code>
account = AccountTypeA(name='something')
account.save()
account.users = User.objects.all()
</code>
is not propagated. However, account.accounttype.users works perfectly fine. Do I do something wrong?
P.S: I'm using Django 1.6
Izidor
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c9da2414-1a13-48df-bc59-d6ee498ae039%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment