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
I am not sure how this could be achieved but I would like to use the django-auto-prefetch when having an abstract model.
I have an example like this:
classAbstractModel(auto_prefetch.Model):
text=models.TextField(max_length=100)
# more abstract fields...created_by=auto_prefetch.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
)
classMeta:
abstract=TrueclassModelA(AbstractModel):
field_a=models.TextField(max_length=100)
# more fields for ModelA...classModelB(AbstractModel):
field_b=models.TextField(max_length=100)
# more fields for ModelB...
When I run python manage.py makemigrations I get the following ERRORS;
myapp.ModelA: (auto_prefetch.E001) ModelA inherits from auto_prefetch.Model, but its Meta class does not inherit from auto_prefetch.Model.Meta
myapp.ModelB: (auto_prefetch.E001) ModelB inherits from auto_prefetch.Model, but its Meta class does not inherit from auto_prefetch.Model.Meta
Is there any trick to use auto-prefetch on an abstract model or do I have to stop using the abstract model? Maybe saving some microseconds in the queries is better than saving some lines of code 😅
Many thanks!
The text was updated successfully, but these errors were encountered:
Description
I am not sure how this could be achieved but I would like to use the django-auto-prefetch when having an abstract model.
I have an example like this:
When I run
python manage.py makemigrations
I get the following ERRORS;Is there any trick to use auto-prefetch on an abstract model or do I have to stop using the abstract model? Maybe saving some microseconds in the queries is better than saving some lines of code 😅
Many thanks!
The text was updated successfully, but these errors were encountered: