Reputation: 16168
i have a site with django, is showing a basic view, and the admin site,
but when i log into the admin site i cannot see the models:
this are my models.py
from django.db import models
# Create your models here.
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Admin:
pass
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
class Admin:
pass
so im referencing the admin from my db scheme,
but cannot see this tables in my admin,
what is missing?
thanks!
Upvotes: 4
Views: 4182
Reputation: 11645
You need to create a file called admin.py
and register any models you want to be accessible from the Django admin:
from django.contrib import admin
from myproject.myapp.models import MyModel
class MyModelAdmin(admin.ModelAdmin):
pass
admin.site.register(MyModel, MyModelAdmin)
Upvotes: 14