I got this weird error in Django Admin while using the ForeignKey from djongo.models. Not sure if I did anything wrong in the models file. Error Message Image
Machine/models.py
from djongo import models
class Machine(models.Model):
_id = models.ObjectIdField(primary_key=True)
machine_type = models.TextField(null=False)
machine_description = models.TextField(null=False)
def __str__(self):
return self.machine_type
# Create your models here.
class Errorcode(models.Model):
_id = models.ObjectIdField(primary_key=True)
code_name = models.TextField(null=False)
machine_type = models.ForeignKey('Machine', on_delete=models.CASCADE)
description = models.TextField(null=False)
instruction = models.TextField(null=False)
def __str__(self):
return self.code_name
class AdditionalFile(models.Model):
error_code = models.ForeignKey('Errorcode', on_delete=models.CASCADE)
file_name = models.TextField(blank=True)
file_path = models.FileField(blank=True, upload_to='static/asset')
def __str__(self):
return self.file_name
If any other files is needed to inspect the problem, I can add the code here.