Django Bananas - Django extensions the monkey way
Project description
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)),
]
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-bananas-1.0.8.tar.gz
(14.3 kB
view hashes)
Built Distribution
Close
Hashes for django_bananas-1.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de4941715cb1dd56dead0bc3896ed1ad38da360bb174beaf4655c40dbb6dfed5 |
|
MD5 | 301d95b4b21920ebd0d660ebaa117a28 |
|
BLAKE2b-256 | 8f5d0ca3fc6a582d9a70342a8b497b1be57b0a7445cdf0c5d4f51b173e3697a6 |