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
1
vote
1 answer

what is difference b/w django-admin startapp vs python manage.py startapp?

both does the same job creating the app in projects what the different between these two in Django?
Max
  • 21
  • 3
1
vote
2 answers

Why are models having there parent class names in admin Django

I have created models like this class User(AbstractUser): login_count = models.PositiveIntegerField(default=0) class Supplier(User): company_name= models.CharField(max_length=30) company_domain=models.CharField(max_length=30) …
1
vote
1 answer

Django how to create errors while adding new objects

See first the code. models.py class Schauspieler(models.Model): schauspieler = models.CharField(max_length=100) def __str__(self): return self.schauspieler admin.py class SchauspielerAdmin(admin.ModelAdmin): ordering =…
1
vote
1 answer

Django admin list_display of different data types with null

I know I explained the title poorly, look I have a simple chat app where users can send text/audio/video/image and for me to render those messages I have a method that checks the type of the message and renders it accordingly if it was text then i…
user14387653
1
vote
1 answer

Django admin: How to show calculated value from entered values dynamically in Django admin form page?

I have a form which is having a 'price', 'tax' and 'discount' fields (IntegerFields). And then one more read-only field will be there called 'total_price'. while we enter the 'price', 'discount' and 'tax', automatically 'total_price' value should…
1
vote
2 answers

Django 2.1 admin.py changeform_view method error with blank tables

In my admin.py i use changeform_view method for mantain some data into an add form after save Fo example one of my admin class is: class temp_mainAdmin(admin.ModelAdmin): form = TempMainForm list_filter = ('t_type',) list_display =…
1
vote
1 answer

Validate end_date is bigger than start_date in custom action of Django Admin

I have a start_date and end_date fields in save_related action of my Django Admin. I want to assign an error to end_date when it is bigger than start_date. I have been looking docs, but don't find an example about that. Here is what i have tried so…
NinjaDev
  • 1,228
  • 11
  • 21
1
vote
1 answer

Running django admin command via curl or request.post

I have a special Django admin action called "run_test". I would like to start that action from a Jenkins job on some items. Something like this was my idea import json import requests url = "http://localhost:8000/admin/app/model/" item = { "user":…
1
vote
2 answers

Django-Admin TabularInline modify inline item attribute before save

Hi I need to be able to add the current user to an inline object as it is being saved or modified. I am using django-admin dashboard as this application is not public facing. class Med(models.Model): generic_name =…
1
vote
1 answer

Hitting an API from Django admin Panel

In Django admin Panel. I have a model which has fields like userID, name, status. I want to call an API (e.g:- www.xyx.com?user=userID&status='approved') when status="approved" is selected and click on save button.
1
vote
2 answers

Django - Displaying model having content type in admin panel

I am new to Django and I am facing a problem. I have multiple model that require address and phone number against address. And only phone number can be associated with some of models. So, I have made polymorphic relation for "Addresses" and…
1
vote
1 answer

Extracting Admin ManyToManyField to CSV file

I'm currently trying to learn django. I'm working on a personal project. I'm trying to create an action in the admin panel for extracting data from my model to a CSV File. For example, I have the following Model: class OrderItem(models.Model): …
1
vote
2 answers

Remove 'Delete selected model' button from related model fields in model creation form (Django admin)

In my models I have Document model with foreign key to the Library model. When I am in Django admin site I want to disable editing and deleting Library instances when I am creating new Document. What I tried was to remove delete and edit…
umat
  • 607
  • 1
  • 13
  • 25
1
vote
1 answer

How to include most recent entry from a reverse FK when exporting from django admin to csv files?

I have the following models: class Person(models.Model): name = models.CharField(max_length=45) etc... class Clothes(models.Model): person = models.ForeignKey(Person) etc... I have the following in admin.py class ExportCsvMixin: …
Fish
  • 215
  • 1
  • 9
1
vote
3 answers

queryset.update is not working in for loop

I want to change the name for any database variable if its match abc. def icall(modeladmin, request, queryset): for pri in queryset: print('from test:', pri.name, pri.title) # priting if working fine if pri.name == 'abc': …