django-multilingual admin TabularInline form

26 views
Skip to first unread message

Ángel Díaz

unread,
Oct 6, 2011, 5:37:01 AM10/6/11
to django-multilingual
I'm using django 1.1.1, django-multilingual 0.1.0 and python 2.5.2
because this are the project requirements.

And I have:

I have two classes in my models.py (classA and classB):

classA(models.Model):
nom = models.CharField(max_length=64)


classB(models.Model):
attr1 = models.ForeignKey(classA,related_name='classb')
class Translation(multilingual.Translation):
nom = models.CharField(max_length=64)
One TabularInline form in admin.py defined as:

class ABInline(admin.TabularInline):
model = models.classB
fieldsets = (
(None, {
'fields': ('nom',)
}
)
)

class AForm(ModelForm):
def __init__(self, *args, **kwargs):
super(AutorForm, self).__init__(*args,**kwargs)
query = Q(classA=None) | Q(classA=self.instance)

class AAdmin(admin.ModelAdmin):
form = AForm
inlines = [ABInline]

admin.site.register(models.classA,AAdmin)
My problem is that if i leave the field 'nom' (field translated in
classB) in the fieldsets of the ABInline form, the classA dissapears
from the web administration of django.

Any ideas?

Thanks in advance,

Ángel.
Reply all
Reply to author
Forward
0 new messages