E
E
Egorian2018-05-18 18:27:20
Django
Egorian, 2018-05-18 18:27:20

The model does not appear in the admin panel?

#models.py
from django.db import models


class Articles(models.Model):
    title=models.CharField(max_length=120)
    post=models.TextField()
    date=models.DateTimeField()
    def __str__(self):
        return self.title
class Projects(models.Model):
    title=models.CharField(max_length=120)
    post=models.TextField()
    date=models.DateTimeField()
    def __str__(self):
        return self.title
class Proj(models.Model):
    title=models.CharField(max_length=120)
    post=models.TextField()
    date=models.DateTimeField()
    def __str__(self):
        return self.title
#admin.py
from django.contrib import admin
from news.models import Articles,Projects,Proj

admin.register(Articles)
admin.register(Projects)
admin.register(Proj)

Now I'll get down to business. The server is running on localhost. Decided to add another model. Before that, there was the Articles model and it was displayed in the admin panel. How I added the model:
python manage.py makemigrations
python manage.py migrate It appears
that everything went well, but the model did not appear in the admin panel
Read this question, maybe the same problem? Although I have local

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Sergeev, 2018-05-18
@Egorian

admin.site.register(ModelName)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question