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.
See Documentation
Installing from pypi
pip install djgentelellaConfigure your settings
INSTALLED_APPS = [ ..
'djgentelella',
'rest_framework',
'markitup',
]
MARKITUP_FILTER = ('markdown.markdown', {'safe_mode': True})
MARKITUP_SET = 'markitup/sets/markdown/'
JQUERY_URL = NoneRun migrations
python manage.py migrateCreate statics files downloading from internet (you need to install requests for this step).
pip install requests
python manage.py loaddevstaticAdd djgentelella urls in your project urls.py file
from djgentelella.urls import urlpatterns as djgentelellaurls
urlpatterns = djgentelellaurls + [
...
]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
To run the all test use:
cd demo
python manage.py testTo run the responsive test use:
cd demo
python manage.py test demoapp.tests.selenium.responsivecd demo
python manage.py migrate
python manage.py createdemo
python manage.py demomenuAnd More see demo app.
make init_demobase.js is autogenerated so you need to call
python manage.py createbasejsRemember update the package version before make deploy it on server.
To add a new translation for a word there are two options:
django-admin makemessages --allThis 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.jsThis 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"))To fix use vendors files need to update the line 53
await asyncio.wait(map(lambda runner: asyncio.create_task(runner.future), running))in the root {venv}/lib/python3.11/site-packages/pylp/cli/run.py.
