Makes your Django models extendable.
Project description
The ex-model lets you extend models in apps by adding mixins to them. The mixins can override fields and methods of the original model.
Example:
# file: staff.models
from django.db import models
from exmodel import Model, extend_model
class Person(Model):
name = models.CharField(max_lenth=10)
def __unicode__(self):
return self.name
class Meta:
app_label = 'staff'
verbose_name = 'Person name'
class PersonMixin(object):
name = models.CharField(max_lenth=500)
alias = models.CharField(max_lenth=500)
def __unicode__(self):
return u'%s (%s)' % (self.name, self.alias)
class Meta:
verbose_name = 'Person name and alias'
extend_model('staff.Person', PersonMixin)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-exmodel-0.0.2.tar.gz
(8.0 kB
view details)
File details
Details for the file django-exmodel-0.0.2.tar.gz.
File metadata
- Download URL: django-exmodel-0.0.2.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e165f51f54b9d1e16dd778cef466f1f02fbbc858b164a24ebc60373e07752259
|
|
| MD5 |
38050ebbdc87aad918c5144b2841c36c
|
|
| BLAKE2b-256 |
1e6c48705a6cff7f72c2855e99151500b41cc0df6457704ae34158c7e1ccb954
|