Help building extra widgets for forms and speciall methods to render forms in templates
Project description
This application is a set of utilities that will make developing applications with django and bootstrap 5 easier, as it provides a set of Javascript libraries such as select2, icheck, datatables and more nicely integrated as widgets or utilities that simplify application creation.
This app helps you to integrate Django apps with Gentelella building extra widgets for forms and speciall methods to render forms in templates.
Documentation
See Documentation
Installation
Installing from pypi
pip install djgentelella
Configure your settings
INSTALLED_APPS = [ ..
'djgentelella',
'rest_framework',
'markitup',
]
MARKITUP_FILTER = ('markdown.markdown', {'safe_mode': True})
MARKITUP_SET = 'markitup/sets/markdown/'
JQUERY_URL = None
Run migrations
python manage.py migrate
Create statics files downloading from internet (you need to install requests for this step).
pip install requests
python manage.py loaddevstatic
Add djgentelella urls in your project urls.py file
from djgentelella.urls import urlpatterns as djgentelellaurls
urlpatterns = djgentelellaurls + [
...
]
Usage
In forms
from djgentelella.forms.forms import GTForm
from djgentelella.widgets import core as genwidgets
class myform(GTForm, forms.ModelForm):
class Meta:
model = MyObject
fields = '__all__'
widgets = {
'name': genwidgets.TextInput,
'borddate': genwidgets.DateInput,
'email': genwidgets.EmailMaskInput
}
In templates working with forms
{{ form.as_plain }}
{{ form.as_inline }}
{{ form.as_horizontal }}
In templates using base template
{% extends 'gentelella/base.html' %}
Take a look this file to note the template block that you can overwrite
Test
To run the all test use:
cd demo
python manage.py test
To run the responsive test use:
cd demo
python manage.py test demoapp.tests.selenium.responsive
Run the demo
cd demo
python manage.py migrate
python manage.py createdemo
python manage.py demomenu
And More see demo app.
Notes for development
base.js is autogenerated so you need to call
python manage.py createbasejs
Remember update the package version before make deploy it on server.
sudo apt install node-babel-cli npm webpack
Translation
To add a new translation for a word there are two options:
django-admin makemessages --all
This command adds words that are inside django templates to locale/es/LC_MESSAGES/django.po, there these words can be translated.
To add a word you can use the following syntax.
{% trans "new_word" %}
For words used in JavaScript files, the following command must be executed.
django-admin makemessages -d djangojs -l es --ignore *.min.js
This command adds words that are inside the gettext js function, to locale/es/LC_MESSAGES/djangojs.po, there these words can be translated.
Here is an example of gettext implementation:
alert(gettext("new_word"))
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 djgentelella-0.3.21.tar.gz
.
File metadata
- Download URL: djgentelella-0.3.21.tar.gz
- Upload date:
- Size: 10.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1957a685700af1b895a4347d2a01a0b86b9a0483eadc0bd30ef47ed2a268615 |
|
MD5 | 102dc75764fab835cfdc9472a6621c0e |
|
BLAKE2b-256 | 368dbd33d6fbed305deefc2b60c004d4e850fcd92b1d0eb2da8edec2afdce708 |
File details
Details for the file djgentelella-0.3.21-py3-none-any.whl
.
File metadata
- Download URL: djgentelella-0.3.21-py3-none-any.whl
- Upload date:
- Size: 10.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 001cbe998641816bb4eef2e47f436e546da7f13d02f3be07b536f51d3e9e07b6 |
|
MD5 | 4afe0b14614d5014686d35fdcd7e4d64 |
|
BLAKE2b-256 | efc039d44b2cdb9cb39b8ae92eb0ee8b29b62ae1a21a8381d41702c48afdf22a |