#32733: DEFAULT_AUTO_FIELD feature leads `AbstractModel.check()` to fail with
AttributeError
-------------------------------------+-------------------------------------
Reporter: amureki | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by amureki):
Replying to [comment:1 Johannes Maron]:
> It is arguable, whether if the checks need to work on an abstract class.
I also noticed that Django will raise an error since 3.2 if you try to
instantiate an abstract model.
> Though, there is no place where checks are called on abstract models
inside an application, this does make unit testing harder.
>
> With that in mind, maybe this is best classified as an optimization not
a bug, since no public API is broken, not does this affect the application
itself. However, since Django is a developer-friendly framework and comes
with an excellent test suite, I believe an improvement would be welcome by
many.
Thanks, Johannes!
I made a draft [https://github.com/django/django/pull/14375 PR] with blunt
solution - freshly introduced auto-field check would not run on abstract
models.
I am more than happy to get better ideas or any other feedback!
--
Ticket URL: <https://code.djangoproject.com/ticket/32733#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.37626bfde45df77cb8da1ea48f2aec16%40djangoproject.com.