Hi and thank you so much,  this provided a ton of clarity, especially
the modelling of the order table with a foreign key to a user, I was
locked on thinking the user table needed to somehow have the orders
within it. But I see I needed to step back.

I've already started to implement all of this and I am trying to
understand the  additional table, if the Order table already contains
the user it belongs to, then what will the additional table be set
for, from my perspective would this be to keep the original order?

Thanks so much again.

On Aug 20, 6:10 pm, Gelonida N <gelon...@gmail.com> wrote:
> On 08/21/2011 12:56 AM, Christian Ramsey wrote:
>
>
>
>
>
>
>
>
>
> > Hi I am a Django beginner and I am just getting into creating apps
> > with it, my goal was to create a simple
> > order application for practice. The app will be somewhat like this:
>
> > 1.A user will login or create an account.
> > 2.A user will order from a list of items and depending on the item it
> > may have size and/or type, some will have preset sizes and no type at
> > all.
> > 3. Upon purchase which for this demo will not have a monetary system
> > integrated, so as a replacement it will email the admin email with the
> > details and also display the order to them for printing once they are
> > finished.
> > 4. The user will be able to check his/her orders in which the admin
> > will be able to set to pending or shipped to each order
> > 5. The admin will also be able to view all orders from every user and
> > delete, edit, mark the details of the order.
>
> > Pretty straightforward I thought but I can't seem to wrap my head
> > around the models mostly and especially the product table.
>
> > For the products would I be creating an array of different orders and
> > a separate array of sizes in the controller and assigning that to the
> > form?
>
> > My 3 classes in my model are currently Users, Products, Orders
> > I am not sure how a order from the products is assigned to a user in
> > the database,
> > does the Users class need to have both products and orders inside of
> > it as a one to many for both?
>
> > So when I create the form that submits this information how does it
> > assign that order to that product to that user?
>
> I guess you could already start with the products and the users.
> This is what yuou need in any case and which allows you already to learn
> qutie some django.
> - Create the User and product Models and create either your own views or
> admin views such, that you can populate the Users and Product database.
>
> Then you could work on the view allowing a logged in user to select
> products to be put in the shopping cart.
>
> Only then you had to care about how to implement the shopping cart.
>
> I never implemented a shopping application and  what I suggest is very
> probably neither the most elegant nor the most efficient solution.
> But what is clear is, that you should use at least one table more.
>
> Example Suggestion:
>
> User: contains info about the user
>
> Product: info about a product and it's price (though price might be in a
> separate table)
>
> Order: Info about the order, which could be ForeignKey to a user, the
> order date, and perhaps payment status.
>
> And one table more, which would store one entry of a order:
> it would store a oeign Key to a Product, the selected amount and a
> ForeignKey to the order it belongs to.
>
> Hope this gave you some ideas of how to get started.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to