Skip to main content

To automate the Django Admin displaying.

Project description

Example

from daa.admin import AutoModelAdmin

from django.db.models import Q

from django.utils.html import format_html

class OwnershipModelAdmin(AutoModelAdmin):

def get_queryset_Q(self, request):

return Q(owner=request.user)

def get_form_field_queryset_Q(self, db_field, request):
if db_field.name==’account’:

return Q(onwer=request.user)

def get_form_fields_exclude(self,request,obj=None):

return () if obj else (‘owner’,)

def action(self,obj):

return format_html(‘<a href=”url” class=”button”>Load</a>’)

extra=(‘action’,)

Install

pip install django-admin-auto

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-admin-auto-0.1.1.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file django-admin-auto-0.1.1.tar.gz.

File metadata

  • Download URL: django-admin-auto-0.1.1.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for django-admin-auto-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f88a41f65dad537c8afe7e97ce6dd8ed45a932ae9031ed172c9352bb26ecb061
MD5 d8ee682d1f1a405e37a0edcd61c50c6d
BLAKE2b-256 86b1b524afd2d347541da8265f64def7478dedcc959c5a7963cf828e35156ef4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page