Genrerate adminlte cruds for models
Project description
ajaxlte
Available features:
-
class based views Rewritable methods for class based views.
-
adminlte 3.0 Using adminlte template 3.0.
-
Traslation Traslation Suport by Locales.
Requirements
- Python = 3
- Django >= 3.05
- django-crispy-forms >= 1.9.0
Installation
pip install django-ajaxlte
settings.py
- Add 'ajaxlte' in your INSTALLED_APPS.
INSTALLED_APPS = [
'ajaxlte',
...
]
urls.py
- Put grappelli extras urls in 'urlpatterns':
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('ajax/', include('ajaxlte.ajax_urls')),
]
How to use
In your models.py import BaseModel and use like parent.
from django.db import models
from ajaxlte.models import BaseModel
class Foo(BaseModel):
code = models.CharField(max_length=35, null=True, blank=True)
name = models.CharField(max_length=165, null=True, blank=True)
def __str__(self):
return self.code
class Bar(BaseModel):
foo = models.ForeignKey(Foo, on_delete=models.CASCADE)
code = models.CharField(max_length=35, null=True, blank=True)
name = models.CharField(max_length=165, null=True, blank=True)
def __str__(self):
return self.code
In your views.py
from ajaxlte.generics import Index, Datatables, AjaxSite
from .models import *
# creating de index page
class TestIndex(Index):
proyect_name = "proyect name"
site = AjaxSite
# creating the foo datatable
class FooDatatable(Datatables):
site = AjaxSite
model = Foo
list_display = ('code', 'name')
search_fields = ('code', 'name')
# add index site
AjaxSite.name_space = "testapp"
AjaxSite.set_index(TestIndex)
# add menu
AjaxSite.add_pill('test1')
# register classes
AjaxSite.register(FooDatatable, 'test1')
# 'test1' is the name of the menu than you want to put this module
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-ajaxlte-1.0.8.tar.gz
(7.8 MB
view details)
File details
Details for the file django-ajaxlte-1.0.8.tar.gz
.
File metadata
- Download URL: django-ajaxlte-1.0.8.tar.gz
- Upload date:
- Size: 7.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52214659207b1ac250f2886b1ab684a8ceb3a87f69bcffc8799bb20ea9847e88 |
|
MD5 | bab0e49bfd63db92b70b45df51f4ac27 |
|
BLAKE2b-256 | f4b750dd4588dcac67bc5a3e826d9b02c3c5f09f32a912f3793fa31dbe19b0f8 |