Hi all i am not able to save the entry of sub_cat field
here is my model.py
class MainCategory(models.Model):
main_cat_code= models.CharField(max_length=20,primary_key=True)
description = models.CharField(max_length = 50,)
def __unicode__(self):
return self.main_cat_code
class SubCategory(models.Model):
sub_cat_code= models.CharField(max_length=20,primary_key=True)
main_category=models.ForeignKey(MainCategory)
description = models.CharField(max_length = 50)
def __unicode__(self):
return self.description
In admin.py: i am using stackedline. and i have registered
MainCategoryAdmin
class SubInline(admin.StackedInline):
model = SubCategory
extra = 1
class MainCategoryAdmin(admin.ModelAdmin):
list_filter=['main_cat_code']
search_fields = ['main_cat_code']
inlines = [SubInline]
admin.site.register(MainCategory, MainCategoryAdmin)
Its not giving any error but when i digged into database and check the
Sub category table, i see sub_cat_code field blank or empty
Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---