Я работаю над проектом Django и зарегистрировал все свои модели в админке. Но по какой-то причине я не могу изменить ни один экземпляр созданной мной модели. Вот как это показывает:
This is the initial screen as I log in.
As soon as I click on add/change, instead of the usual screen it shows like this:
Второй экран
Вот мои models.py и admin.py: admin.py:
from django.contrib import admin
from .models import Plant, Unit, Equipment, EquipmentCategories, Job, Task_category, Subtask_category, SubtaskStatus, TaskStatus, Files, Filetype, Comment, Timelog, Report, Approvals, Task_flow, Subtask_flow
# Register your models here.
admin.site.register(Plant)
admin.site.register(Unit)
admin.site.register(EquipmentCategories)
admin.site.register(Equipment)
admin.site.register(Job)
admin.site.register(Task_category)
admin.site.register(TaskStatus)
admin.site.register(Subtask_category)
admin.site.register(SubtaskStatus)
admin.site.register(Files)
models.py:
from django.db import models
from django.contrib.auth.models import User
import django.dispatch
# Create your models here.
class Plant(models.Model):
name = models.CharField(max_length=200)
start_date = models.DateField(null=True,blank=True)
end_date = models.DateField(null=True,blank=True)
def __str__(self):
return(self.name)
class Unit(models.Model):
plant = models.ForeignKey(Plant,related_name='Plant', on_delete=models.CASCADE)
name = models.CharField(max_length=200)
unit_location = models.CharField(max_length=200, null=True)
start_date = models.DateField(null=True,blank=True)
end_date = models.DateField(null=True,blank=True)
def __str__(self):
return(self.name)
class EquipmentCategories(models.Model):
unit = models.ForeignKey(Unit,related_name='Unit', on_delete=models.CASCADE)
name = models.CharField(max_length=200)
def __str__(self):
return(self.name)
Кто-нибудь, пожалуйста, помогите ! Заранее спасибо :)