I'm trying to create a model that has 2 fields with the same related object (Call):
class Call(LogsMixin, models.Model):
"""Definición del modelo de Proveedor."""
id = models.CharField("ID de la convocatoria", primary_key=True, null=False, default="", max_length=50)
name = models.CharField("Nombre de convocatoria", null=False, default="", max_length=200)
active = models.BooleanField("Activada", default=True)
class Consumption(LogsMixin, models.Model):
"""Definición del modelo de Consumos"""
client = models.ForeignKey('authentication.Client', verbose_name=("Cliente"), null=True, default=None, on_delete=models.SET_DEFAULT)
sap_price = models.DecimalField(("Precio de SAP"), max_digits=6, decimal_places=2, null=False, default=0)
access_date = models.DateField("Fecha de acceso", auto_now=False, auto_now_add=False)
call = models.ForeignKey(Call, verbose_name=("Convocatoria"), null=True, default=None, on_delete=models.SET_DEFAULT)
accessible_calls = models.ManyToManyField(Call, verbose_name=("Convocatorias accesibles"))
When I try to make the migrations I receive the next error:
ERRORS: consumptions.Consumption.accessible_calls: (fields.E304) Reverse accessor for 'Consumption.accessible_calls' clashes with reverse accessor for 'Consumption.call'. HINT: Add or change a related_name argument to the definition for 'Consumption.accessible_calls' or 'Consumption.call'. consumptions.Consumption.call: (fields.E304) Reverse accessor for 'Consumption.call' clashes with reverse accessor for 'Consumption.accessible_calls'. HINT: Add or change a related_name argument to the definition for 'Consumption.call' or 'Consumption.accessible_calls'.
And yes, I read the HINT, but it's not what I need
I need this because I need the call that the client selected and the calls that he can choose
Does anyone have any clue?