You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following does not work because the name "request_message" is duplicated in two child classes of the base class Message, which produces a conflict later on when querying the database.
class Message(TypedModel):
pass
class AcceptMessage(Message):
request_message = models.ForeignKey('self', null=True, blank=True, related_name='+')
class DeclineMessage(Message):
request_message = models.ForeignKey('self', null=True, blank=True, related_name='+')
This can be solved by moving request_message to the base class but this is not always what you want (perhaps a third class inheriting from Message does not have a request_message field).
It would be nice if TypedModel would at least raise an exception in this case so that the programmer becomes aware of the problem.
The text was updated successfully, but these errors were encountered:
The following does not work because the name "request_message" is duplicated in two child classes of the base class Message, which produces a conflict later on when querying the database.
class Message(TypedModel):
pass
class AcceptMessage(Message):
request_message = models.ForeignKey('self', null=True, blank=True, related_name='+')
class DeclineMessage(Message):
request_message = models.ForeignKey('self', null=True, blank=True, related_name='+')
This can be solved by moving request_message to the base class but this is not always what you want (perhaps a third class inheriting from Message does not have a request_message field).
It would be nice if TypedModel would at least raise an exception in this case so that the programmer becomes aware of the problem.
The text was updated successfully, but these errors were encountered: