A pack of shortcuts for Django.
Project description
djgo
Description
This package provides some shortcuts for your django app.
Installation
pip install djgo
Usage
djgo has shortcuts for different parts of the app.
To use it, simply import it with import djgo
.
manage.py
Method start_django()
(or manage()
) is a shortcut for launching Django.
wsgi.py
Method set_wsgi()
is a shortcut that sets Django settings env variable and returns default wsgi application.
urls.py
Method load_app()
is a shortcut that loads and returns an app module or its part.
app/contrib.py
Method app_config()
is a shortcut that sets Django app config. Example:
from djpp import app_config
default_app_config = app_config(verbose_name='My Cool App')
app/models.py
Decorator @meta
is a shortcut that sets meta and __str__() for your model.
WARNING: All meta defined this way won't register in migrations.
Example:
@meta(single='My Client', plural='My Clients', display='name')
class Client(models.Model):
name = models.CharField()
is equal to
class Client(models.Model):
name = models.CharField()
class Meta:
verbose_name = 'My Client'
verbose_name_plural = 'My Clients'
def \_\_str\_\_():
return self.name
except the meta (name and verbose_name) won't register in migrations.
You can also pass functions to display
:
@meta('My Client', display=lambda self: 'Cool ' + str(self.name))
class Client(models.Model):
name = models.CharField()
is equal to
class Client(models.Model):
name = models.CharField()
class Meta:
name = 'My Client'
verbose_name = 'My Client'
def \_\_str\_\_():
return 'Cool ' + str(self.name)
except the meta (name and verbose_name) won't register in migrations.
djgo.admin
djgo has a small set of methods for admin site and admin.py file:
admin.urls
is a shortcut forpath('url', admin.site.urls)
, except adds '/' in the end of your url string if it doesn't have one.admin.meta
is a shortcut for settingadmin.site.site_header
andadmin.site.site_title
.admin.clear_models
is a shortcut for clearing models from admin site registry.admin.quick_inline
is a decorator for setting some tabular inline params.
Other features
You can also access settings through djgo with djgo.settings
!
Lastly, djgo provides a small log()
method for printing some info.
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
Built Distribution
File details
Details for the file djgo-0.0.2.tar.gz
.
File metadata
- Download URL: djgo-0.0.2.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.1 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d7b43d9feeb5298749136407c36ac16e7b9dc076a59ed152eb93c775187e788 |
|
MD5 | 4c58c0df31c31e06fd84bce29a029547 |
|
BLAKE2b-256 | 97325307c1b758e4f1af8458ac69f22cfb568eaeec48c117b3c31341ae72bf90 |
File details
Details for the file djgo-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: djgo-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.1 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 902c878633b0ba21a749e804733eedb40f7ab004c63c997866ecb41424532729 |
|
MD5 | bbfc4b37c6b12f046d79d671ea569acb |
|
BLAKE2b-256 | ae0e0a717debbcd2eccb3496a8e354adaf9d4d1626cd137653a5fc9abdc98b71 |