Questions tagged [django-admin-actions]

Django Admin Actions django-admin comes by default with django installation and it is one of strongest feature of django. So there are many actions that can be taken by django like add user, change their permissions, change their access levels and many more.

113 questions
0
votes
1 answer

Django admin custom queryset for a custom action

I am a bit lost on how to perform a specific queryset in django admin. Below are my models. class People(models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=35) phone_number =…
0
votes
1 answer

Displaying link in admin using model admin

class DirectAdmin(admin.ModelAdmin): def order_pdf(obj): # return "pdf".format( url=reverse('orders:admin_order_pdf', args=[obj.id]) return "http://localhost:8000" + url order_pdf.allow_tags = True …
john
  • 539
  • 2
  • 9
  • 24
0
votes
1 answer

Django model reference and manipulation

I have the following models in Django that have a structure as follows: class Office_Accounts(models.Model): accountid = models.EmailField(max_length=200, unique=True) validtill = …
0
votes
1 answer

Error while adding data using Django Administration's panel

I'm currently experimenting with the Django framework and i've made an application that includes 2 models. The first one is the user model which contains the user and some basic information about them. The second model is the Image model which has…
0
votes
1 answer

list_display not showing email_verified field in ModelAdmin Django

I am list displaying the following fields in Django ModelAdmin. list_display = ['username', 'email_verified', 'cert_password', 'key_name'] in this list the items - username, cert_password and key_name belongs to a a model ModelName and the item…
0
votes
1 answer

Automatic file download in Django

I am creating a file download functionality on link click from admin panel in django. I am using FileField for storing the files. For the download purpose I researched and found help on stackoverflow. After using that help, I have the following code…
0
votes
0 answers

Can't logging into django admin panel

In production, after entering username and password in order to access django admin panel, the website arrises following error 'OperationalError at /admin/login/ unable to open database file' Here's my settings of db.sqlite3 DATABASES = { …
Natiq Vahabov
  • 495
  • 4
  • 13
0
votes
1 answer

Dynamic dropdown on intermediate page for admin action

I have a model Jar which has a crate attribute -- a ForeignKey to a Crate model. The Crate model has a capacity attribute (the number of jars it can hold) and a jars property (the number of jars it currently holds) which is this line: return…
Jack Twilley
  • 346
  • 2
  • 10
0
votes
1 answer

Django 1.11 use template from an app as admin template

as the title said i am having a problem using a template in an admin view here is my worktree project |-- project/ |-- myapp/ |-- templates/ |-- admin/ |-- file.html settings.py TEMPLATES = [ { 'BACKEND':…
0
votes
1 answer

How can one replicate Django admins add new row functionality?

I am looking for a way to implement the "add new model_name" functionality from Django admin to normal form in templates, i.e; outside of Django admin, how could I use the same functionality. How could I achieve it?
Maverick
  • 2,738
  • 24
  • 91
  • 157
0
votes
1 answer

Adding Django-admin-action with conditions

I have my django model Customer which consists of these fields; 'Customer_ID', 'Name', 'Gender', 'Age', 'Nationality', 'Address', 'Account_Type', 'Salary', 'Balance', 'Employer_Stability', 'Customer_Loyalty', 'Residential_Status' and…
Terry Mafura
  • 147
  • 2
  • 15
0
votes
2 answers

Filter to show "null" relations (where no results related to the item)

Quite simply, django filter (standard) give you the option to see "All". I want to create an option to show items which contain "None" The query would be something like this: tags = Product.objects.exclude(tag__isnull=True) My models.py class…
Ycon
  • 1,830
  • 3
  • 27
  • 56
0
votes
0 answers

Django admin action gets wrong queryset

I am making an admin action that change status field in my model.It's my action code def update_status(self, request, queryset): form = None if 'apply' in request.POST: form = ChangeStatusForm(request.POST) if…
Dima Kudosh
  • 7,126
  • 4
  • 36
  • 46
0
votes
1 answer

What is the recommended approach to implement admin-actions-alike functionality outside admin?

I've been searching a way to reproduce admin-actions behavior on my own tables using django-tables2. I haven't found any module to introduce this functionality to a ListView to derive from it and looking at ModelAdmin I see there are many methods…
serguitus
  • 476
  • 6
  • 10
0
votes
0 answers

Get an attribute of the model from ModelForm without the instance (overriding __init__)

I have a MultipleChoiceField and for displaying the values that had been previous selected in the admin, I have to override method init from a ModelForm. I have the following class with its form: class Profile(models.Model): name =…