#parent class
class ObjectJourney(Base):
journey_type = models.ForeignKey('Journey.JourneyType')
entry_time = models.DateTimeField(auto_now_add=True)
exit_time = models.DateTimeField(null=True,blank=True)
#child class
class BookingJourney(ObjectJourney):
journey_object = models.ForeignKey('RequestBooking.Booking')
journey_entity = models.ForeignKey(
'UserManagement.C24customer', related_name='journeys')
Migrations file contains
migrations.CreateModel(
name='BookingJourney',
fields=[
('objectjourney_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE,
parent_link=True, primary_key=True, serialize=False, to='Journey.ObjectJourney')),
],
options={
'abstract': False,
},
bases=('Journey.objectjourney',),
),
#Following are the error trails visible in terminal
File "/home/jagdamba/testenv/lib/python3.6/site-packages/django/db/migrations/state.py", line 308, in render_multiple
model.render(self)
File "/home/jagdamba/testenv/lib/python3.6/site-packages/django/db/migrations/state.py", line 579, in render
return type(self.name, bases, body)
File "/home/jagdamba/testenv/lib/python3.6/site-packages/django/db/models/base.py", line 253, in __new__
base.__name__,
django.core.exceptions.FieldError: Auto-generated field 'objectjourney_ptr' in class 'BookingJourney' for parent_link to base class 'ObjectJourney' clashes with declared field of the same name.
My attempts to solve this error
-Deleted migrations and created new migration.
-ALso followed steps of this article...
https://www.kidstrythisathome.com/2016/10/wtf-django-moving-models-part1.html