Welcome to Django Powerbank’s documentation!¶
Contents:
Django Powerbank¶
Extra power for included batteries
- Free software: MIT license
- Documentation: https://django-powerbank.readthedocs.io.
Work in progress¶
This package was created with wooyek/cookiecutter-django-app project template. It may fool you by having a lot of cookie filling just ready from the start. Be warned! It may not be ready for eating!
Features¶
- Pending :D
Demo¶
To run an example project for this django reusable app, click the button below and start a demo serwer on Heroku
Quickstart¶
Install Django Powerbank:
pip install django-powerbank
Add it to your INSTALLED_APPS:
INSTALLED_APPS = (
...
'django_powerbank.apps.DjangoPowerbankConfig',
...
)
Add Django Powerbank’s URL patterns:
from django_powerbank import urls as django_powerbank_urls
urlpatterns = [
...
url(r'^', include(django_powerbank_urls)),
...
]
Running Tests¶
Does the code actually work?
$ pipenv install --dev
$ pipenv shell
$ tox
We recommend using pipenv but a legacy approach to creating virtualenv and installing requirements should also work. Please install requirements/development.txt to setup virtual env for testing and development.
Credits¶
This package was created with Cookiecutter and the wooyek/cookiecutter-django-app project template.
Installation¶
Stable release¶
To install Django Powerbank, run this command in your terminal:
$ pip install django-powerbank
This is the preferred method to install Django Powerbank, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
From sources¶
You can either clone the public repository:
$ git clone git://github.com/wooyek/django-powerbank
Or download the download source from project website. Once you have a copy of the source, you can install it with:
$ python setup.py install
Usage¶
To use Django Powerbank in a project, add it to your INSTALLED_APPS:
INSTALLED_APPS = (
...
'django_powerbank.apps.DjangoPowerbankConfig',
...
)
Add Django Powerbank’s URL patterns:
from django_powerbank import urls as django_powerbank_urls
urlpatterns = [
...
url(r'^', include(django_powerbank_urls)),
...
]
Api docs¶
django_powerbank package¶
Subpackages¶
django_powerbank.core package¶
Submodules¶
django_powerbank.core.validators module¶
-
class
django_powerbank.core.validators.
MaxCurrentYearValidator
[source]¶ Bases:
object
-
deconstruct
()¶ Return a 3-tuple of class import path, positional arguments, and keyword arguments.
-
message
= 'Ensure this value is less than or equal to %(limit_value)s.'¶
-
-
class
django_powerbank.core.validators.
MaxTodayDateValidator
[source]¶ Bases:
object
-
deconstruct
()¶ Return a 3-tuple of class import path, positional arguments, and keyword arguments.
-
message
= 'Ensure this value is less than or equal to %(limit_value)s.'¶
-
Module contents¶
django_powerbank.db package¶
Subpackages¶
-
class
django_powerbank.db.models.fields.pl.
PlNipField
(*args, **kwargs)[source]¶ Bases:
django.db.models.fields.CharField
-
class
django_powerbank.db.models.fields.
AutoSlugField
(source_field=None, keep_existing=False, source_fallback=False, *args, **kwargs)[source]¶ Bases:
django_powerbank.db.models.fields.SourceFieldMixin
,django.db.models.fields.SlugField
-
class
django_powerbank.db.models.fields.
BinaryMaskEnum
[source]¶ Bases:
django_powerbank.db.models.fields.ChoicesIntEnum
An enumeration.
-
class
django_powerbank.db.models.fields.
ChoicesIntEnum
[source]¶ Bases:
enum.IntEnum
Extends IntEum with django choices generation capability
-
class
django_powerbank.db.models.fields.
JSONField
(*args, **kwargs)[source]¶ Bases:
django.db.models.fields.TextField
Simple JSON field that stores python structures as JSON strings on database.
-
to_python
(value)[source]¶ Convert the input JSON value into python structures, raises django.core.exceptions.ValidationError if the data can’t be converted.
-
-
class
django_powerbank.db.models.fields.
MarkDownField
(source_field=None, *args, **kwargs)[source]¶ Bases:
django_powerbank.db.models.fields.SourceFieldMixin
,django.db.models.fields.TextField
-
class
django_powerbank.db.models.fields.
PhoneField
(*args, **kwargs)[source]¶ Bases:
django.db.models.fields.CharField
-
default_validators
= [<django_powerbank.core.validators.MsisdnValidator object>]¶
-
-
class
django_powerbank.db.models.fields.
SecretField
(source_field=None, *args, **kwargs)[source]¶ Bases:
django_powerbank.db.models.fields.SourceFieldMixin
,django.db.models.fields.CharField
-
class
django_powerbank.db.models.fields.
SourceFieldMixin
(source_field=None, *args, **kwargs)[source]¶ Bases:
object
-
class
django_powerbank.db.models.fields.
UniqueSlugField
(source_field=None, keep_existing=False, *args, **kwargs)[source]¶ Bases:
django_powerbank.db.models.fields.AutoSlugField
,django.db.models.fields.SlugField
-
class
django_powerbank.db.models.base.
BaseModel
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
-
class
django_powerbank.db.models.query.
ApproxQuerySet
(model=None, query=None, using=None, hints=None)[source]¶ Bases:
django.db.models.query.QuerySet
Module contents¶
django_powerbank.forms package¶
Submodules¶
django_powerbank.forms.fields module¶
-
class
django_powerbank.forms.fields.
DateRangeField
(input_formats=None, *args, **kwargs)[source]¶ Bases:
django.forms.fields.DateField
-
to_python
(value)[source]¶ Validate that the input can be converted to a date. Return a Python datetime.date object.
-
widget
¶ alias of
django.forms.widgets.Input
-
-
class
django_powerbank.forms.fields.
PhoneField
(*, max_length=None, min_length=None, strip=True, empty_value='', **kwargs)[source]¶ Bases:
django.forms.fields.CharField
-
widget
¶
-
django_powerbank.forms.widgets module¶
-
class
django_powerbank.forms.widgets.
PhoneInput
(attrs=None)[source]¶ Bases:
django.forms.widgets.TextInput
-
input_type
= 'tel'¶
-
media
¶
-
-
class
django_powerbank.forms.widgets.
SelectizeBase
(attrs=None, url=None, allow_create=False, value_field='text', label_field='text', search_field='text', plugins=[], close_after_select=True)[source]¶ Bases:
django.forms.widgets.Input
-
media
¶
-
-
class
django_powerbank.forms.widgets.
SelectizeSelect
(attrs=None, url=None, allow_create=False, value_field='text', label_field='text', search_field='text', plugins=[], close_after_select=True)[source]¶ Bases:
django_powerbank.forms.widgets.SelectizeBase
,django.forms.widgets.Select
A selectize.js field
It requires selectize.js and headjs to be avaialable in the browser. See a template below to se why. You can provide your own template to use selectize.js in a different way.
-
media
¶
-
template_name
= 'django_powerbank/forms/widgets/selectize/select.html'¶
-
-
class
django_powerbank.forms.widgets.
SelectizeTags
(attrs=None, url=None, allow_create=False, value_field='text', label_field='text', search_field='text', plugins=[], close_after_select=True)[source]¶ Bases:
django_powerbank.forms.widgets.SelectizeBase
-
media
¶
-
template_name
= 'django_powerbank/forms/widgets/selectize/tags.html'¶
-
Module contents¶
django_powerbank.testing package¶
Submodules¶
django_powerbank.testing.base module¶
-
class
django_powerbank.testing.base.
MigrationsCheck
(methodName='runTest')[source]¶ Bases:
django_powerbank.testing.base.MigrationsCheckMx
,unittest.case.TestCase
django_powerbank.testing.factories module¶
-
class
django_powerbank.testing.factories.
UserFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
-
email
= <factory.faker.Faker object>¶
-
first_name
= <factory.faker.Faker object>¶
-
is_active
= True¶
-
is_staff
= False¶
-
last_name
= <factory.faker.Faker object>¶
-
username
= <factory.declarations.Sequence object>¶
-
django_powerbank.testing.utils module¶
Module contents¶
django_powerbank.views package¶
Submodules¶
django_powerbank.views.auth module¶
-
class
django_powerbank.views.auth.
AbstractAccessView
(**kwargs)[source]¶ Bases:
django_powerbank.views.ExceptionResponseView
Allows you to handle authorization before dispatch is called
-
class
django_powerbank.views.auth.
AbstractAuthorizedView
(**kwargs)[source]¶ Bases:
django_powerbank.views.auth.AuthenticatedView
-
forbidden_message
= 'You are not authorized to view this page'¶
-
-
django_powerbank.views.auth.
AccessMixin
¶
-
class
django_powerbank.views.auth.
AuthenticatedView
(**kwargs)[source]¶ Bases:
django_powerbank.views.auth.AbstractAccessView
redirects unauthenticated users to login
-
class
django_powerbank.views.auth.
StaffRequiredMixin
(**kwargs)[source]¶ Bases:
django_powerbank.views.auth.AbstractAuthorizedView
django_powerbank.views.generic module¶
django_powerbank.views.mixins module¶
-
class
django_powerbank.views.mixins.
ReturnUrlMx
(**kwargs)[source]¶ Bases:
django.views.generic.base.ContextMixin
,django.views.generic.base.View
Module contents¶
-
exception
django_powerbank.views.
ExceptionResponse
(response)[source]¶ Bases:
Exception
Generic exception for signalling that instead of default error handling we should use attached response
-
class
django_powerbank.views.
ExceptionResponseView
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
-
exception
django_powerbank.views.
Http302
(to, *args, **kwargs)[source]¶ Bases:
django_powerbank.views.ExceptionResponse
Wraps a redirect shortcut call into the ResponseException
-
exception
django_powerbank.views.
Http403
(response)[source]¶ Bases:
django.core.exceptions.PermissionDenied
,django_powerbank.views.ExceptionResponse
A convenience wrapper around :py:class:~django.core.exceptions.PermissionDenied`
Submodules¶
django_powerbank.app_settings module¶
django_powerbank.apps module¶
Module contents¶
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/wooyek/django-powerbank/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” and “help wanted” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “enhancement” and “help wanted” is open to whoever wants to implement it.
Write Documentation¶
Django Powerbank could always use more documentation, whether as part of the official Django Powerbank docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/wooyek/django-powerbank/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up django-powerbank for local development.
Fork the django-powerbank repo on github.com
Clone your fork locally:
$ git clone git@github.com:your_name_here/django-powerbank.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv django-powerbank $ cd django-powerbank/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:
$ flake8 django-powerbank tests $ tox -e check $ python setup.py test or py.test $ tox
To get flake8 and tox, just pip install them into your virtualenv.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- The pull request should work for Python versions mentioned in tox.ini file. Check https://travis-ci.org/wooyek/django-powerbank/pull_requests and make sure that the tests pass for all supported Python versions.
Credits¶
Development Lead¶
- @wooyek: Janusz Skonieczny <js+pypi@bravelabs.pl>
Contributors¶
None yet. Why not be the first?