Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django admin site models not showing

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: enter image description here

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!

like image 473
manuelBetancurt Avatar asked Dec 09 '22 01:12

manuelBetancurt


1 Answers

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)
like image 78
twaddington Avatar answered Jun 04 '23 03:06

twaddington