0

Possible Duplicate:
Nested inlines in the Django admin?

I'm developing an application for a catering company, using Python, Django and PostgreSQL. I have tried to use the Django Admin module as a way to add orders. I want to be able to do everything on one page. I am starting to believe it may not be possible.
Do not worry, only office staff will be using this part of the software, not the general public.

Our pricing structure works on the number of items per person, multiplied by the people being catered for.

Here is an example:


Order for "Fake Company":

  • Morning Tea of 2 items at $8.00 x 10ppl:     #This is what we call a deal, items have no price.
    • Gluten Free Biscuits x1
    • Sausage Roll x10
    • Biscuits x9
       
  • Lunch of 3 items at $10.00 x 10ppl:
    • Sausage Roll x5
    • Sushi x5
    • Sandwich x10
    • Sweet Platter x10

Total: $180


 

The way each order is structured in the database is like this:
-COMPANY
  -SALE (One-TO-One relationship with COMPANY)
    -DEAL_INSTANCE (One-To-One relationship with both SALE and a DEAL)
      -ITEM (Many-TO-Many relationship with DEAL_INSTANCE through a join table, as an item quantity
                  field is required)

I have managed to get everything but adding items to a DEAL_INSTANCE, on one page. Due to Django Admin not really liking Many-To-Many Relationships defined with the 'through' attribute.

Here is a link to a screenshot of what I already have, just to clarify things (just copy image location to view fullsize): What I have so far.

So in closing, I ask is it possible to have this whole process on one page using Django Admin? If not, what's the best way to go about it using Django and should I change the layout of my database?

Thanks in advance, I know this is a bit of an odd situation to get your head around. I am a Django newbie, but proficient in Python; so you may need to hold my hand when it comes to Django.

4

1 に答える 1

0

いいえ、ネストされたインラインは管理者では使用できません。

#9025管理者のネストされたインラインサポート

管理インターフェースは、実際には汎用インターフェース以外のものとして設計されているわけではなく、最も信頼できるユーザー以外のユーザーへのアクセスには使用しないでください。

管理者以外のdjangoビューでネストされたインラインを実行することはそれほど難しくありません。「djangoネストされたインライン」をグーグルで検索すると、いくつかの解決策が明らかになります。

于 2012-10-05T11:19:15.567 に答える