Build inline admin page (TabularInline) for M2M relationship
$30-250 USD
Pago na entrega
Hi all
TabularInlines work fine if the relationship between two models is based on a foreign key.
For example, if there is a Restaurant model and a Pizza model (with a foreign key to Restaurant), it is easy to add Pizza to the Restaurant admin page as a TabularInline:
class RestaurantAdmin([login to view URL]):
inlines = (PizzaAdminInline,)
class PizzaAdminInline([login to view URL]):
model = Pizza
The problem I am having is if the relationship is a many-to-many relationship.
For example, let's say there is a M2M relationship between Pizza and Toppings. (Pizzas can have many toppings, and toppings can go on many pizzas).
If I create [login to view URL] code like this, the inline will only contain the M2M relationship (the Pizza_Toppings object):
class PizzaAdmin([login to view URL]):
inlines = (ToppingAdminInline,)
exclude = ('toppings',)
class ToppingAdminInline([login to view URL]):
model = [login to view URL]
I think if you've used Django Admin Inlines you know the exact problem I'm talking about.
So, I need you to create a custom view/form/whatever to make ToppingAdminInline display all the Topping Model fields, just like they would be displayed if the relationship was a foreign key rather than a many-to-many.
Please let me know if you have any questions.
Thanks!
ID do Projeto: #11978771
Sobre o projeto
9 freelancers estão ofertando em média $146 nesse trabalho
Hello, Thank you for the posting. Please share the existing system so that I can overview the code. I also need to check the DB. Kindly initiate PM and discuss in detail about your expectations. In case of Mais
Hello, My name is Adil, I am certified python expert I have 4 years+ experience in python language and . i have completed 100+ projects using python .. Expertise : Python, Django, Django-Rest- Framework and many pyth Mais
Hi there, I have four years of experience with django framework, I can fix your problem, please consider. Thanks and Regards, Bijumon