Install
django-bananas is on PyPI, so just run:
pip install django-bananas
Compatibility
Currently bleeding edge, tested in
Django 1.8 under Python 3.4
pull requests welcome!
Examples
Models
Abstract TimeStampedModel with date created/modified fields:
Use TimeStampedModel as base class for your model
from bananas.models import TimeStampedModel
class Book(TimeStampedModel):
pass
the timestamps can be accessed on the model as
>>> book.date_created
>>> book.date_modified
ORM
New queryset.dicts() with field renaming through kwargs, and dot-dict style results:
from bananas.query import ExtendedQuerySet
class Book(TimeStampedModel):
author = ForeignKey(Author)
objects = Manager.from_queryset(ExtendedQuerySet)()
>>> book = Book.objects.dicts('id', author='author__name').first()
{'id': 1, 'author': 'Jonas'}
>>> book.author
'Jonas'
Admin
Custom django admin stylesheet.
# settings.py
INSTALLED_APPS = (
'bananas', # Needs to be before 'django.contrib.admin'
'django.contrib.admin',
...
)
ADMIN = {
'SITE_HEADER': 'Bananas',
'SITE_TITLE': 'Bananas Admin',
'INDEX_TITLE': 'Admin Panel',
# 'BACKGROUND_COLOR': '#363c3f',
}
# your main urls.py
from bananas import admin
urlpatterns = [
...
url(r'^admin/', include(admin.site.urls)),
]
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-bananas-1.0.8.tar.gz.
File metadata
- Download URL: django-bananas-1.0.8.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68099590f8aa1d24c866bbcdadf4c02258b8f61374abb285286d674f3e036c49
|
|
| MD5 |
1fd608b7e16bca44882851dd3e858204
|
|
| BLAKE2b-256 |
2e7bc8ac9b950018fd01e5056a6f8a9413c365f8c279e55b9062ecb76fe413a8
|
File details
Details for the file django_bananas-1.0.8-py3-none-any.whl.
File metadata
- Download URL: django_bananas-1.0.8-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de4941715cb1dd56dead0bc3896ed1ad38da360bb174beaf4655c40dbb6dfed5
|
|
| MD5 |
301d95b4b21920ebd0d660ebaa117a28
|
|
| BLAKE2b-256 |
8f5d0ca3fc6a582d9a70342a8b497b1be57b0a7445cdf0c5d4f51b173e3697a6
|