Questions tagged [django-modeladmin]
132 questions
0
votes
0 answers
Access related model fields from ModelAdmin actions for exporting to excel
I am desperately waiting for someone attention to get my question answered.... please help..
ModelAdmin model has to export to Excel action method.
I need to access related model fields in action method. That means I can not pass any arguments…

G-2
- 11
- 1
- 5
0
votes
2 answers
Django admin do not display all fields
This question is created to help other people with similar problem. I know how to fix the issue, but I'm also interested Why this happens.
In my models.py I've had a model
class CEOSetting(models.Model):
title = models.CharField('Заголовок',…

David
- 272
- 2
- 8
0
votes
0 answers
AttributeError: 'NoneType' object has no attribute 'distinct'
I have the below table view
CREATE VIEW vStaff
AS
SELECT ContactInfo .*, Staff.position
FROM ContactInfo
LEFT JOIN Staff ON Staff.name = ContactInfo.name
that selects information from these two models
class ContactInfo(models.Model):
name =…

lewis machilika
- 819
- 2
- 11
- 25
0
votes
1 answer
Model Admin Error: Cannot Exclude Field because it is a Foreign Key to the parent model
My goal is to be able to select a location and Input part numbers without seeing this quote field. I dont even completely understand what this select box is looking for. I have Quote objects saved and yet these are not coming up as selectable…

enjoi4life411
- 568
- 5
- 11
0
votes
1 answer
django: don't register ModelAdmin (exclude module-level code) when running makemigrations / migrate
I have made multiple changes to an existing django model (added new foreign key relation, etc). Before creating and applying these changes with manage.py makemigrations / migrate, I adapted the corresponding admin module's ModelAdmin for that app to…

zet0x
- 21
- 3
0
votes
1 answer
django admin have choice option in field depend on values in other field
I'm just starting out in Django, and am having trouble setting up a model on the admin side.
Here is the situation. I have 12 centers, each with over 20 laboratories.
I have a model class for publications. On the admin side, I want to be able to…

anp925
- 59
- 4
0
votes
0 answers
Objects not being displayed in Django Admin when Foreign key is Null
I have a Model "Item" that has a field "req_item", that's a nullable foreign key. Everything seems to working fine, but when the "req_item" field is null, the object is not displayed in django admin altogether. Here's the image for reference:
All…

Vishal
- 51
- 6
0
votes
1 answer
How to call user variables in Django ModelAdmin
I am new to Django and having trouble understanding how to call proper variables in a ModelAdmin. If I am on /admin/mt_app/my_model/ that I have information like the user's name OR I'm on /admin/auth/user/2/change/ that has all the user's…

Austin
- 103
- 10
0
votes
1 answer
django model _meta.get_fields() just datettime fields
I have want gather just fieldname type is datetime by
_meta.get_fields()
Model.py :
class testmodel (models.Model):
name = models.CharField(max_length=200)
field = models.CharField('field', max_length=50, choices=(), default=None)
…

MohammadReza moeini
- 190
- 1
- 10
0
votes
1 answer
Doesn't see records in admin site of django
I have a problem with one of my tables that I created in my django Project. The recording of data via administration site is very good, but I do not see any record. when I try to see the records in recent actions, I get the following message…

leauradmin
- 321
- 2
- 11
0
votes
1 answer
Custom Model action/function in django admin
I am trying to send newsletters as emails to the subscribed users. For that, I did:
I made a Custom send_mail() function within my model to send emails to subscribed users
class Post(models.Model):
'model fields here'
def __str__(self):
…

Anubhav Madhav
- 173
- 2
- 9
0
votes
1 answer
I want to query to get the details from the command line
In The Models.py file (I have this codebase)
class Person(models.Model):
sex_choices = (
('Male', 'Male'),
('Female', 'Female')
)
martial_choices = (
('Single', 'Single'),
('Married', 'Married'),
…

wan0004
- 1
- 1
0
votes
2 answers
How to register a normal user in django from front end using custom user model?
# Custom User Model Code
from django.db import models
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
class MyUserManager(BaseUserManager):
def create_user(self, email, favorite_color, password=None):
…

Saptorshe Das
- 19
- 9
0
votes
1 answer
How to return value from custom database lookup based on model value in Django admin list_display?
Searched the internet a lot for this, tried many solutions but didn't get it working.
I have these models.
models.py
class Cadastro(models.Model):
id_cadastro = models.AutoField(primary_key=True)
categoria_tipo =…

victorlm.moura
- 1
- 1
0
votes
1 answer
Django. Hash password in models.py
I have a trigger in my database to create a password from another column and update it in the current database. Then I insert this password to another table.
The problem is my project doesn't need a registration form as a new page. So only admin…

dannycrief
- 91
- 1
- 14