Re: adding a model to show up in admin

2009-08-10 Thread zignorp

Thank you so much Malcolm,
I knew I was missing something elementary.  Thanks for pointing it
out.
Cheers,
Wendy


On Aug 10, 8:58 pm, Malcolm Tredinnick 
wrote:
> On Mon, 2009-08-10 at 20:43 -0700, zignorp wrote:
> > Hello,
> > I just added a model to models.py,
>
> > class Topic (models.Model):
> >    topic = models.CharField(max_length=180, blank=True, null=True)
>
> >    def __unicode__(self):
> >            return self.topic
>
> > I can see it in the model that's calling it:
> > class Film(models.Model):
> >         topic = models.ManyToManyField(Topic, blank=True)
>
> > but I can't see it in the admin.
>
> Did you add a call in your admins.py file to register Topic with the
> admin? Like you will have done for the Film model?
>
> Models don't automatically show up in the admin interface. The admin app
> needs to be told they exist.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: adding a model to show up in admin

2009-08-10 Thread Malcolm Tredinnick

On Mon, 2009-08-10 at 20:43 -0700, zignorp wrote:
> Hello,
> I just added a model to models.py,
> 
> class Topic (models.Model):
>   topic = models.CharField(max_length=180, blank=True, null=True)
> 
>   def __unicode__(self):
>   return self.topic
> 
> I can see it in the model that's calling it:
> class Film(models.Model):
> topic = models.ManyToManyField(Topic, blank=True)
> 
> but I can't see it in the admin.

Did you add a call in your admins.py file to register Topic with the
admin? Like you will have done for the Film model?

Models don't automatically show up in the admin interface. The admin app
needs to be told they exist.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



adding a model to show up in admin

2009-08-10 Thread zignorp

Hello,
I just added a model to models.py,

class Topic (models.Model):
topic = models.CharField(max_length=180, blank=True, null=True)

def __unicode__(self):
return self.topic

I can see it in the model that's calling it:
class Film(models.Model):
topic = models.ManyToManyField(Topic, blank=True)

but I can't see it in the admin.  I can save topics through the
console:
>> from films.models import Topic
>>> p1 = Topic(topic='Arts')
>>> p1.save()
>>> topic_list = Topic.objects.all()
>>> topic_list
[]

and then see the topic show up in a choice in the film admin, but I
still don't see a separate topics admin.  I hope this makes sense.
These are what they look like when I run sqlall:

CREATE TABLE "films_topic" (
"id" integer NOT NULL PRIMARY KEY,
"topic" varchar(180)
)



CREATE TABLE "films_film_topic" (
"id" integer NOT NULL PRIMARY KEY,
"film_id" integer NOT NULL REFERENCES "films_film" ("id"),
"topic_id" integer NOT NULL REFERENCES "films_topic" ("id"),
UNIQUE ("film_id", "topic_id")
)
;

And I can see them in the db.

Any help would be greatly appreciated,
Thanks,
Wendy
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---