Questions tagged [django-inline-models]

12 questions
10
votes
6 answers

How to display inline uploaded images in "Change" page in Django Admin?

I'm trying to display inline uploaded images in "Change List" page in Django Admin: This is my code below: # "models.py" from django.db import models class Product(models.Model): name = models.CharField(max_length=50) price =…
Shaniqwa
  • 1,924
  • 2
  • 17
  • 29
2
votes
1 answer

Django Inline Tabular admin: delete an object not working

I'm using Django admin.TabularInline class inorder to add multiple objects in a Foreinkey relationship as below: admin.py: class HeadFlowDatasetInline(admin.TabularInline): model = HeadFlowDataset extra = 0 class…
Vahid
  • 249
  • 4
  • 12
2
votes
1 answer

Django - Hide labels in inline

How to hide labels in Django inlines?
1
vote
1 answer

Django admin StackedInline throws (admin.E202) 'accounts.CustomUser' has no field named 'user' error

I have a CustomUser model, and a Retailer model that holds the additional details of retailer user type. The Retailer model has a OneToOne relation to CustomUser model. There is no public user registration or signup, accounts are created by…
1
vote
0 answers

How to validate Child model (StackedInline) fields based on a value of Parent model's field in Django?

I have following structure. models.py class Parent(models.Model): PROVIDER1 = "Provider1" PROVIDER2= "Provider2" PROVIDERS= ( (PROVIDER1, "Test Provider One"), (PROVIDER2, "Test Provider Two"), ) provider =…
Amol Chakane
  • 1,501
  • 2
  • 21
  • 43
1
vote
1 answer

Display image in Django admin - Many to many inline admin view

I have the following models: class AModel(BaseModel): a_id = models.AutoField(primary_key=True) name = models.CharField(max_length=200) a_images = models.ManyToManyField(BModel) class BModel(BaseModel): images =…
0
votes
1 answer

Hiding extra field Django Admin

I want to display an extra field based on a boolean check associated with the model. if obj.boolean: exclude(self.extra_field) But the issue with this is that the extra field is not associated with the model so it is throwing error stating model…
0
votes
0 answers

It is possible to show two sibling models into one's inline admin

I have one parent model, called Farmer, which has foreign key relationship with two child models namely, FarmerAdvisory and ImageDetail. I want to show ImageDetail as an inline model to FarmerAdvisory in admin panel. Is this possible? FarmerAdvisory…
0
votes
0 answers

Show secondary foreign key values in the inline django admin

models.py class FarmerAdvisory(BaseModel): id = models.AutoField(db_column='id', primary_key=True) title = models.CharField(db_column='title', max_length=200, null=True, blank=True) description = models.CharField(db_column='description',…
0
votes
0 answers

Filter data in django admin inline create view

this is my first post here and im hoping to find a solution for my situation: The thing is... I got a admin inline who show the relate info of a model. by this, i can see which contract_product belongs to current client. When im creating a new…
0
votes
0 answers

filtering the queryset in an Inline object in Django Admin

The context is an inventory app of an e-commerce project. As expected, there's a Product model. In an attempt to normalize the DB schema, I have created these additional models: ProductType (ForeignKey relationship in Product) ProductSpecification…
alexakarpov
  • 1,848
  • 2
  • 21
  • 39
0
votes
0 answers

Django Error (admin.E106) ModelInline must have a 'model' attribute

Was just following the tutorials from Django documentation. In Writing your first Django app, part 7, the tutorial was adding the Choice section when a user is adding a Question. In the documentation, the code seems to work fine, but in my system,…