Django admin interface reading __str__() after inline delete

Django admin interface reading __str__() after inline delete

By : Laughing.W
Date : November 17 2020, 11:58 AM
like below fixes the issue
Why would the admin interface be trying to read the str() method of an object I've just removed? Should I edge-case the amount() method?
code :

Share : facebook icon twitter icon
Django - Designing Model Relationships - Admin interface and Inline

Django - Designing Model Relationships - Admin interface and Inline

By : Huajian Wen
Date : March 29 2020, 07:55 AM
Hope this helps Since it seems you want a UserProfile or Department to have potentially many addresses, your ForeignKeys are backward. A single ForeignKey can only point to one model instance, whereas there is no limit on the number of ForeignKeys that can point to a single model instance. So your ForeignKey should be on Address (in which case your inline would work as-is).
The complicating factor is that you have a single Address model and you want to relate it to two other models; a single ForeignKey on Address can't point to both UserProfile and Department. One solution is to have two address models (DepartmentAddress, with a ForeignKey to Department, and UserAddress, with a ForeignKey to UserProfile). You could reduce duplication in your code by having these both inherit from an abstract base class containing all the data fields, but you still end up with two mostly-identical tables in your database.
Django admin interface: using horizontal_filter with inline ManyToMany field

Django admin interface: using horizontal_filter with inline ManyToMany field

By : Roc
Date : March 29 2020, 07:55 AM
Hope that helps The problem isn't from having inlines; it's from the way ModelForms work, in general. They only build form fields for actual fields on the model, not related manager attributes. However, you can add this functionality to the form:
code :
from django.contrib.admin.widgets import FilteredSelectMultiple

class ProjectAdminForm(forms.ModelForm):
    class Meta:
        model = Project

    userprofiles = forms.ModelMultipleChoiceField(
            verbose_name='User Profiles',

    def __init__(self, *args, **kwargs):
        super(ProjectAdminForm, self).__init__(*args, **kwargs)
            if self.instance.pk:
                self.fields['userprofiles'].initial = self.instance.userprofile_set.all()

    def save(self, commit=True):
        project = super(ProjectAdminForm, self).save(commit=False)  
        if commit:

        if project.pk:
            project.userprofile_set = self.cleaned_data['userprofiles']

        return project

class ProjectAdmin(admin.ModelAdmin):
    form = ProjectAdminForm
How to display InLine objects in Django Admin Interface

How to display InLine objects in Django Admin Interface

By : J. Doe
Date : March 29 2020, 07:55 AM
hope this fix your issue The problem is not your admin interface, but how you create the Question objects. You need to iterate through the result of your function and create linked items for each one:
code :
for question_text in Question_Init(user_input_obj):
     user_questions_obj = Question(user_text=user_input_obj,
Django - Excluding some fields in Inline Admin Interface

Django - Excluding some fields in Inline Admin Interface

By : Sirawat Ant Prasert
Date : March 29 2020, 07:55 AM
Any of those help with exclude you can do it
Add custom action to Django inline object on the admin interface

Add custom action to Django inline object on the admin interface

By : Anderson Fogaça
Date : March 29 2020, 07:55 AM
wish helps you I guess the right thing to make this is Admin actions as described in documentation -
Related Posts Related Posts :
  • python imblearn make_pipeline TypeError: Last step of Pipeline should implement fit
  • Write to csv: columns are shifted when item in row is empty (Python)
  • DuckDuckGo search returns 'List Index out of range'
  • Python function which can transverse a nested list and print out each element
  • Python installing xlwt module error
  • Python mayavi: Adding points to a 3d scatter plot
  • Making a basic web scraper in Python with only built in libraries - Python
  • How to calculate the angle of the sun above the horizon using pyEphem
  • Fix newlines when writing UTF-8 to Text file in python
  • How to convert backward slash command in python to run on Linux
  • PyCharm Code Inspection doesn't include PEP 8
  • How can I use Python namedtuples to insert rows into mySQL database
  • Increase / Decrease Mac Address in Python from String
  • Scrollable QLabel image in PyQt5
  • (Python 2.7) Access variable from class with accessor/mutator
  • Why does "from [Module] import [Something]" takes more time than "import [Module"
  • jira python oauth: how to get the parameters for authentication?
  • Python - How to specify a relative path by jumping a subdirectory?
  • Extract scientific number from string
  • Scrapy: Python cannot find the spider
  • get the values in a given radius from numpy array
  • Is it possible to duplicate a pipe in Python, so that it has one write end but two read ends?
  • Why does wget use Firefox cookies to login on an authenticated webpage?
  • python import behaviour: different objects from same file?
  • Create YoY Graph with Matplotlib
  • Safe use of eval() or alternatives - python
  • Unix change desktop background seamlessly
  • Profiling Python code that uses multiprocessing?
  • How to query a database after render_template
  • shifting right in for loop over indices in python
  • Is there a way to switch code indentation from tabs to spaces across the project, and to keep 'hg annotate' functionalit
  • Disable/Close/Quit/Exit Terminal screen from python on Geany (Ubuntu)
  • for i in xrange() not running the complete script
  • ImportError ropevim using ropevim plugin in vim
  • How to read each line from a file into list word by word in Python
  • Creating Unique Names
  • python split a string when a keyword comes after a pattern
  • Same Python code returns different results for same input string
  • Call a Flask function every few minutes
  • Python: Using Ghost for dynamic webscraping
  • How to make while iteration faster?
  • Struggling to resolve "a float is required error" in python
  • Read data with NAs into python and calculate mean row-wise
  • How to print telnet response line by line?
  • Pylint: Avoid checking INSIDE DOCSTRINGS (global directive / rcfile)
  • Sending MIDI messages using Python (on Ubuntu)
  • Generate Dictionary in Python at run time
  • code is cluttered by try-except in Python
  • Python class inheritance - spooky action
  • Why is a Python multiprocessing daemon process not printing to standard output?
  • How to feed numeric data into a classifier?
  • How to unambiguously identify a Model as a lowercase string in Django
  • How to get only one specific line from subprocess output
  • Python network communication with encryption and password protection
  • with urllib urlopen read function but get none
  • django could not find database in ubuntu
  • How to replace a character in a string with a non ascii character in python?
  • Self learning data evaluation in Python
  • Django: UnicodeDecodeError while trying to read template 500.html
  • how can you Import an os variable into PYTHON and have it update?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org