Archived
This project has been archived by its maintainers, and is no longer receiving any updates.
- Dowloads:
- Source:
- Keywords:
django, database
–
A django abstract model and form for handling extra content in a model.
Let’s say we have a model MyData which can point to different underlying data types:
from django.db import models
from extracontent.models import ExtraContent
from extracontent.forms import ExtraContentForm
class DataModel1(models.Model):
value = models.TextField()
class DataModel2(models.Model):
dt = models.DateField()
class MyData(ExtraContent):
name = models.CharField(max_length = 20)
class MyDataForm(ExtraContentForm):
class Meta:
model = MyData
Then we can do this:
>>> from extracontent import content
>>> elem = MyDataForm({'content_type':content('datamodel1'),
... 'value':'this is a test', name:'a data object'}).save()
>>> elem.extra_content()
<DataModel1: DataModel1 object>
>>> elem.extra_content().value
'this is a test'
Running Tests
Once installed:
>>>from extracontent.tests import run >>>run()
or from within the tests directory:
python runtests.py
Metadata
Release files for django-extracontent 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distributions (sdists)
| File | Size | Uploaded | |
|---|---|---|---|
| django-extracontent-0.1.zip | 9.8 kB | Details | |
| django-extracontent-0.1.tar.gz | 6.7 kB | Details |
Release files / django-extracontent-0.1.zip
| Download URL | django-extracontent-0.1.zip |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8de20e77a19ebb1270e7185b9f659f1d60b0ed4098da026cf438480a61031f41
|
|
BLAKE2b-256 checksum How to use checksums |
7e52860a20ea28bb90639a46348b7a2ea1243728d27c82c721d112bcd8d2a888
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django-extracontent-0.1.tar.gz
| Download URL | django-extracontent-0.1.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
79950c56cfcfddef07b3c79edbd0f1bee1d3da8d670c5342b8c1b03a55887656
|
|
BLAKE2b-256 checksum How to use checksums |
32bcd353396e5cd6b60b8833f6a5f65e9738b90f74da737dac5b1117e94ff123
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |