Wednesday, May 28, 2014

Re: Prywatna wiadomość na temat: Data + admin design problem

Hi Wojtek

I am not sure how you can say you have implemented this already, when some of my suggestions were not listed in what you said you had done originally.  You need to be careful about this, otherwise people may perceive that you are careless about asking.

I suggest you need to actually present some of the code and models you have already.  Then try and ask on the list in form" "I have tried to do X but i fails because of Y.  OR I want to do A but I cannot because I think I have to use B and that fails or is not working because of C".  The more specific the question is, and the more closely it follows actual code, the better your chance of getting a valid answer. 

Derek

On 28 May 2014 20:43, Wojtas <wojtek.jurkowlaniec@gmail.com> wrote:
Thank you Derek for your response.

What are you writing makes sense, and actually I have it implemented already.  My question is a bit different, I'll rethink it to put in another words and come back here.

Thanks again!
Wojtek

W dniu środa, 28 maja 2014 11:29:54 UTC+2 użytkownik Derek napisał:
Hi

Off the top of my head (as in "do not use directly"!), it seems to me that:

1. You need a boolean field for 'serial' and also one for 'countable' for a Product.  One or both must be checked (use clean() to check) when Product is created.
2. Each Product also needs a 'status' field:  one of 'available', 'on loan' (and, perhaps, 'missing' or 'reserved')
3. I assume that an "Event" is an instance of a Product being lent out (that was not clear) with a one:Many to Products.  Each Event can then pull in Products as needed (but only from those that are 'available').  You could also have "planned" events that can "reserve" items.  A post-trigger on the Event save() can update the "status" field of each item and also make an entry to the ProductHistory (but its not clear at what point in the process a user would add comments??)
4.  Not sure why a Product cannot be effectively linked to a Warehouse via FK?  This should work as a Product cannot be in two places at the same time!

Your comment about "List of items (change_list in admin) shouldn't have 5 items of serial+countable, just one" does not make sense. To do the one:many for an Event, you'd need to add Products, each of which should have its own serial number and status (i.e. serial number and status are NOT detached from a Product but part of the model.)

To be honest, you do not give enough details about the actual data, and user requirements, associated with every item (Product, Warehouse, Event) to really understand your scenario and create the best logic.

HTH though.


On Tuesday, 27 May 2014 01:43:29 UTC+2, Wojtas wrote:
Hi there!
I didn't know where to ask. I'm doing Django for couple of years, and I encountered following problem.

I'm doing a website which manages warehouse of company which lends music instruments.

I have 3 types of products:
serial -> which exist only in amount of 1
countable -> which exist in many amounts, like for example jack cable - they don't need information which one is broken for instance, so just information how many can we take
serial+countable -> normally it doesn't matter which is which, in case sth is lost or broken.

I'm using of course django admin to manage the data. 

Let's call the  warehouse product Stuff
It's not a big problem to save the data and manage it, but I have some specific requirements for serial+countable:
1. Reserve stuff for period of time. All 3 types in specific amount ( if available at this time)
2. Move specific amount of items from one warehouse to another (for instance one serial+countable object gets broken and we need to move them to repair warehouse from main)
3. every serial+countable object should have own history of events + comment history attached to it)
4. List of items (change_list in admin) shouldn't have 5 items of serial+countable, just one, with listing of serial numbers and status of each one of them inside the edit view.


What I achieved so far:
I have models:
Stuff
Event with M2M to Stuff which is through intermediate table with extra count field. So I can check for two basic types of stuff how many are busy at this time.

So far there is no any definition of serial+countable in the models except for char choice field.

So there's a FK from Stuff to Warehouse model, which is not enough.

I hope my problem description is complete. 

Thank you for any help.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF1Wu3M2ZvUFy2wbNxbOuZSfPRxTMLNsiVWzgyrnknF4rh7hYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment