Easy lists for django views
Project description
# django-smart-lists
```python
from smart_lists.mixins import SmartListMixin
class AccountListView(LoginRequiredMixin, SmartListMixin, ListView):
model = Account
paginate_by = 100
ordering_allowed_fields = ['company_name', 'code', 'created_date']
list_display = ['company_name', 'code', 'created_date', 'balance']
```
This will give you a click-to-sort table with pagination. All you have to do is to make a template like this:
```html
{% extends "base.html" %}
{% load smart_list %}
{% block content %}
{% smart_list %}
{% endblock %}
```
**The built-in templates are bootstrap 3 compatible - but override them easily (by positioning the apps in INSTALLED_APPS) to fit your own needs**
# Other features
django-smart-lists supports commmon method attributes supported by django admin, such as:
```python
class EpicModel(models.Model):
title = models.CharField(max_length=128)
def get_pretty_title(self):
return "Pretty {}".format(self.title)
get_pretty_title.short_description = 'Pretty Title'
get_pretty_title.admin_order_field = 'title'
### License
MIT License
Copyright (c) 2017 Plecto
```python
from smart_lists.mixins import SmartListMixin
class AccountListView(LoginRequiredMixin, SmartListMixin, ListView):
model = Account
paginate_by = 100
ordering_allowed_fields = ['company_name', 'code', 'created_date']
list_display = ['company_name', 'code', 'created_date', 'balance']
```
This will give you a click-to-sort table with pagination. All you have to do is to make a template like this:
```html
{% extends "base.html" %}
{% load smart_list %}
{% block content %}
{% smart_list %}
{% endblock %}
```
**The built-in templates are bootstrap 3 compatible - but override them easily (by positioning the apps in INSTALLED_APPS) to fit your own needs**
# Other features
django-smart-lists supports commmon method attributes supported by django admin, such as:
```python
class EpicModel(models.Model):
title = models.CharField(max_length=128)
def get_pretty_title(self):
return "Pretty {}".format(self.title)
get_pretty_title.short_description = 'Pretty Title'
get_pretty_title.admin_order_field = 'title'
### License
MIT License
Copyright (c) 2017 Plecto
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-smart-lists-1.0.19.tar.gz
(11.3 kB
view details)
File details
Details for the file django-smart-lists-1.0.19.tar.gz
.
File metadata
- Download URL: django-smart-lists-1.0.19.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/36.5.0 requests-toolbelt/0.8.0 tqdm/4.19.1.post1 CPython/2.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2daa91a08c0e9db72d6d44189b0dd0ecbbad0b6b8ecf582aa1209b1901911407 |
|
MD5 | a7b19b543f21f6979c10eab3c1feace1 |
|
BLAKE2b-256 | fbb9d11545d89dafde00f9db32afd25e0eb4034f8f3c47cd9fce2bd7d2eb406a |