Hi all! I have 3 classes in model.py
class Category(models.Model): category = models.CharField(max_length=130) def __unicode__(self): return self.category class Subcategory(models.Model): category = models.ForeignKey('Category') subcategory = models.CharField(max_length=130) def __unicode__(self): return self.subcategory class Product(models.Model): subcategory = models.ForeignKey('Subcategory') product = models.CharField(max_length=20) def __unicode__(self): return self.product I'd like to add in product admin form a dropdown of category. I've tried this in admin.py from django.contrib import admin from products.models import Category, Subcategory, Product from django.contrib.admin.options import ModelAdmin from django.http import HttpResponse class AdminProduct(ModelAdmin): #Original Idea. It works #fieldsets= ( (None, {'fields': ('subcategory', 'product')}), ) #Custom. Trying to access category dropdown. It doesnt work fieldsets= ( (None, {'fields': (Subcategory.category, 'subcategory', 'product')}), ) admin.site.register(Product, AdminProduct) Error reported: Error while importing URLconf 'myproject.urls': category must be accessed via instance How can I do to have a select of catagory in the admin form of product? Sorry for my stupid question, I'm beginner :( --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---