An extension of Django ManyToMany with ordering
Project description
django-sortedmanytomany
=======================
> In Django, if you need to order a many to many relation you will have to do it by using inlines width a foreign key and a sorting field. If there is no need to add another field in this relation, use inlines would make the admin interface complex where a simple many to many should do the trick.
Installation
------------
```sh
pip install django-sortedmanytomany
```
Adding to installed apps
------------------------
- To use the many to many sorted field, you have to add it to your INSTALLED_APPS on your project's settings.py so the needed static files can be loaded:
```python
INSTALLED_APPS = (
...
'sortedmanytomany',
)
```
Using SortedManyToManyField
---------------------------
- To use SortedManyToMany field, just create a field as if you were adding the default ManyToMany
```python
from django.db import models
from sortedmanytomany.models import SortedManyToManyField
class Album(models.Model):
...
tracks = SortedManyToManyField('Track')
class Track(models.Model):
...
```
License
-------
MIT
=======================
> In Django, if you need to order a many to many relation you will have to do it by using inlines width a foreign key and a sorting field. If there is no need to add another field in this relation, use inlines would make the admin interface complex where a simple many to many should do the trick.
Installation
------------
```sh
pip install django-sortedmanytomany
```
Adding to installed apps
------------------------
- To use the many to many sorted field, you have to add it to your INSTALLED_APPS on your project's settings.py so the needed static files can be loaded:
```python
INSTALLED_APPS = (
...
'sortedmanytomany',
)
```
Using SortedManyToManyField
---------------------------
- To use SortedManyToMany field, just create a field as if you were adding the default ManyToMany
```python
from django.db import models
from sortedmanytomany.models import SortedManyToManyField
class Album(models.Model):
...
tracks = SortedManyToManyField('Track')
class Track(models.Model):
...
```
License
-------
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-sortedmanytomany-0.1.3.tar.gz.
File metadata
- Download URL: django-sortedmanytomany-0.1.3.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f937a4263141b83779f558bb0a14ccaaac9047b2383eb759d7aec687be2cd2c
|
|
| MD5 |
bfbb269df1d4831ef42e858cbfd10619
|
|
| BLAKE2b-256 |
10b7479531ba88b41d706707c560cc5943153c55684b996350a447281b6a86de
|