Found 1126 bookmarks
Newest
Signals: class_prepared
Signals: class_prepared
Since this signal is sent during the app registry population process, and AppConfig.ready() runs after the app registry is fully populated, receivers cannot be connected in that method. One possibility is to connect them AppConfig.__init__() instead, taking care not to import models or trigger calls to the app registry.
·docs.djangoproject.com·
Signals: class_prepared
Python Metaclasses – Real Python
Python Metaclasses – Real Python
They allow customization of class instantiation.
In Python, there are at least a couple other ways in which effectively the same thing can be accomplished
·realpython.com·
Python Metaclasses – Real Python
MultipleColumnPrimaryKeys – Django
MultipleColumnPrimaryKeys – Django
Currently Django models only support a single column in this set, denying many designs where the natural primary key of a table is multiple columns.
·code.djangoproject.com·
MultipleColumnPrimaryKeys – Django
Django Proxy Model Relations - Schinckel.net
Django Proxy Model Relations - Schinckel.net
I hit upon the idea of using Django’s Proxy models, and using the related Application to determine the subclass
Instead of getting the subclass of AppConfig, that we probably want to use because the business logic hangs off that, we instead get the actual AppConfig instances
Python is a dynamic language, so we should be able to do better.
·schinckel.net·
Django Proxy Model Relations - Schinckel.net
Create OneToOne instance on model creation
Create OneToOne instance on model creation
7 View upvote and downvote totals. This answer is not useful Save this answer. Show activity on this post. An excellent django-annoying plugin solves this for you with AutoOneToOneField
The most common way to accomplish this is to use the Django signals system.
·stackoverflow.com·
Create OneToOne instance on model creation
How to split django groups into subsets
How to split django groups into subsets
Instead of subclassing groups, I recommend adding a GroupType model that will have a many to many relation to group.
·stackoverflow.com·
How to split django groups into subsets