n00b alert, btw:
---------------------------

I'm very new to django so please forgive the stupid questions, but I'm
struggling to get some very basic model relations to work. I'd be very
grateful if someone could show me where I am going wrong.

I have 2 incredibly simple models, where a Project would have one of
many Medium types.

So when in the admin form, I would like a project to have an option
list of Mediums to choose from..

(from work.models.py)
------------------------------------
from django.db import models

class Medium(models.Model):
        medium = models.CharField(max_length=20)

class Project(models.Model):
        title = models.CharField(max_length=80)
        medium = models.ForeignKey(Medium)
------------------------------------

...this validates and SQL looks as it should.

However, when I try to implement the Admin....

(from work.admin.py)
------------------------------------
from portfolio.work.models import Project
from portfolio.work.models import Medium
from django.contrib import admin


class MediumInline(admin.StackedInline):
        """docstring for ClassName"""
        model = Medium
        extra = 3

class ProjectAdmin(admin.ModelAdmin):
        inlines = [MediumInline]

admin.site.register(Project, ProjectAdmin)
------------------------------------

select I get an exception:
<class 'work.models.Medium'> has no ForeignKey to <class
'work.models.Project'>

Have I gotten my data modelling fundamentally incorrect, or am I doing
something wrong in admin.py

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to