Below is my models.py file in a Django project. Whenever I try to run the project I get the following error. Please assist as I have just started picking up django I tried changing the names of the foreign columns as suggested by the error but no avail. A lot of answers out there suggest changes with respect to related_name which does not exist in my case.
Error from console
app_fin.TblLockerCoutCin.jewel_item: (fields.E304) Reverse accessor for 'TblLockerCoutCin.jewel_item' clashes with reverse accessor for 'TblLockerCoutCin.jewel_item_code'. HINT: Add or change a related_name argument to the definition for 'TblLockerCoutCin.jewel_item' or 'TblLockerCoutCin.jewel_item_code'. app_fin.TblLockerCoutCin.jewel_item: (fields.E304) Reverse accessor for 'TblLockerCoutCin.jewel_item' clashes with reverse accessor for 'TblLockerCoutCin.jewel_item_name'. HINT: Add or change a related_name argument to the definition for 'TblLockerCoutCin.jewel_item' or 'TblLockerCoutCin.jewel_item_name'. app_fin.TblLockerCoutCin.jewel_item_code: (fields.E304) Reverse accessor for 'TblLockerCoutCin.jewel_item_code' clashes with reverse accessor for 'TblLockerCoutCin.jewel_item'. HINT: Add or change a related_name argument to the definition for 'TblLockerCoutCin.jewel_item_code' or 'TblLockerCoutCin.jewel_item'. app_fin.TblLockerCoutCin.jewel_item_code: (fields.E304) Reverse accessor for 'TblLockerCoutCin.jewel_item_code' clashes with reverse accessor for 'TblLockerCoutCin.jewel_item_name'. HINT: Add or change a related_name argument to the definition for 'TblLockerCoutCin.jewel_item_code' or 'TblLockerCoutCin.jewel_item_name'. app_fin.TblLockerCoutCin.jewel_item_name: (fields.E304) Reverse accessor for 'TblLockerCoutCin.jewel_item_name' clashes with reverse accessor for 'TblLockerCoutCin.jewel_item'. HINT: Add or change a related_name argument to the definition for 'TblLockerCoutCin.jewel_item_name' or 'TblLockerCoutCin.jewel_item'. app_fin.TblLockerCoutCin.jewel_item_name: (fields.E304) Reverse accessor for 'TblLockerCoutCin.jewel_item_name' clashes with reverse accessor for 'TblLockerCoutCin.jewel_item_code'. HINT: Add or change a related_name argument to the definition for 'TblLockerCoutCin.jewel_item_name' or 'TblLockerCoutCin.jewel_item_code'.
models.py
from django.db import models
class TblJewelleryInventory(models.Model):
id = models.IntegerField(primary_key=True)
item_code = models.CharField(unique=True, max_length=5, blank=True, null=True)
item_name = models.CharField(max_length=250, blank=True, null=True)
base_locker_location = models.CharField(max_length=45, blank=True, null=True)
updated_at = models.DateTimeField()
created_at = models.DateTimeField()
def __str__(self):
return self.name
class Meta:
managed = False
db_table = 'tbl_jewellery_inventory'
class TblJewelleryInventoryLogs(models.Model):
id = models.IntegerField(primary_key=True)
item_id = models.IntegerField()
item_code = models.CharField(unique=True, max_length=5, blank=True, null=True)
item_name = models.CharField(max_length=250, blank=True, null=True)
base_locker_location = models.CharField(max_length=45, blank=True, null=True)
updated_at = models.DateTimeField()
created_at = models.DateTimeField()
triggered_at = models.DateTimeField()
def __str__(self):
return self.name
class Meta:
managed = False
db_table = 'tbl_jewellery_inventory_logs'
class TblLockerCoutCin(models.Model):
jewel_item = models.ForeignKey(TblJewelleryInventory, models.DO_NOTHING)
jewel_item_code = models.ForeignKey(TblJewelleryInventory, models.DO_NOTHING, db_column='jewel_item_code')
jewel_item_name = models.ForeignKey(TblJewelleryInventory, models.DO_NOTHING, db_column='jewel_item_name')
reason = models.CharField(max_length=500, blank=True, null=True)
is_check_out = models.IntegerField(blank=True, null=True)
is_check_in = models.IntegerField(blank=True, null=True)
created_at = models.DateTimeField(blank=True, null=True)
def __str__(self):
return self.name
class Meta:
managed = False
db_table = 'tbl_locker_cout_cin'