All Questions
Tagged with django-admin many-to-many
81 questions
1
vote
1
answer
82
views
Trying to display the reverse of a Many to Many Relationship in Django Admin
Say I'm working on a database that tracks the members in different bands. Each Band will have multiple Musicians, but each Musician can only be in one Band. If my models look like this:
class Band(...
0
votes
1
answer
778
views
Django. Field for selecting values (ManyToMany) as in the admin panel
How to achieve the display of the field for the form (when it is filled) as in the admin panel (screenshot)?
I tried using forms.CheckboxSelectMultiple widget but it doesn't quite fit. It provides the ...
1
vote
1
answer
290
views
Django tabularInline 'categories.Category_children_ids' has more than one ForeignKey to 'categories.Category'. You must specify a 'fk_name' attribute
I'm want to create nested categories, model work fine.
class Category(models.Model):
category_name = models.CharField(max_length=100)
children_ids = models.ManyToManyField(
"...
0
votes
1
answer
1k
views
Adding fields from a many-to-many relationship to a Django Admin Inline
I am trying to set up a project where I have user, questions for the users, and then the answers that the users give. Here are my models.
class User(models.Model):
name = models.CharField(...
2
votes
1
answer
1k
views
Django: Check at model level if anything in ManyToMany field before saving
There's a lot of questions worded similarly, but every single one I've seen is somebody trying to get some kind of data through a ManyToMany relationship before saving it. I'm not trying to use the ...
2
votes
2
answers
3k
views
Django Error admin.E202 'stamm.Workplan' has no ForeignKey to 'enquiry.Costing', Inline-Model in a Many-To-Many Relationship
I'm struggling with the following Problem:
I have created two apps, "stamm" and "enquiry". In the first app "stamm" I have the model Workplan. In the second app "...
0
votes
2
answers
898
views
Django admin list_display is not displaying model method return item
I'm not able to get the list_display of admin to show the information from a model method, but the same method displays fine in the fieldsets on the change page. I think I've fixed all my mistakes ...
0
votes
2
answers
781
views
How can I display all fields from a Many-to-Many Model in Django Admin
I have the following Models:
class ModelA(models.Model):
some_field_A = models.CharField()
some_other_field_A = models.CharField()
class ModelB(models.Model):
some_field_B = models....
1
vote
1
answer
838
views
How to display manytomany field in django admin with a related model in a user-friendly way?
I'm struggling to display a manytomany field in the admin with the related model in a user-friendly manner. The project is already up and running so adding a through table is not preferred.
The set-up ...
1
vote
1
answer
515
views
How can I add a field to a many-to-many relationship in Django?
This is a question about how to add a field to a many-to-many relationship in Django.
I have a model LandingPage and a model Product. (Code below). In my project, LandingPages can have many Products ...
1
vote
2
answers
2k
views
Django prefetch_related with ManyToMany field
I have this two models im my django application (latest version).
class Focal(models.Model):
name = models.CharField(....)
class Company(models.Model):
trade_name = models.CharField(.....
0
votes
1
answer
459
views
How can I access attributes of a model in admin.TabularInline that is at the end of a manytomany relationship with defined through model
I am facing the following scenario;
#models.py
class A(models.Model):
dog = models.CharField(...)
cat_values = models.ManyToManyField(B, through='AtoB')
class AtoB(models.Model):
one = ...
0
votes
1
answer
83
views
Django admin.py ValueError when trying to save manytomany field
I am trying to create a model with a manytomany field in Django, and using the default admin.py interface I am getting a ValueError: needs to have a value for field "id" before this many-to-many ...
1
vote
1
answer
262
views
Django register view of many to many connection table in Admin
I have a Django model, and two model classes with many to many relationships between them.
class A(models.Model):
a = models.ManyToManyField(B, related_name='a')
class B(models.Model):
id = ...
5
votes
0
answers
1k
views
Django ModelMultipleChoiceField lazy loading of related m2m objects
I tried to use django.forms.ModelMultipleChoiceField in one of the model's admin page in order to update m2m relation through form. I also specified django.contrib.admin.widgets.FilteredSelectMultiple ...