Hello  I have these two models:

class SubOrder(models.Model):
    """
    This is model for single order
    it should be used later in complex order
    """

    product = models.ForeignKey(Product)
    quantity = models.SmallIntegerField()

class Order(models.Model):
    "Model for complex order containing many SubOrder instances"

    customer = models.CharField(max_length = 20)
    day = models.DateField(auto_now = True)
    paid  = models.BooleanField(default = False)
    delivered = models.BooleanField(default = False)

    sub_orders = models.ManyToManyField(SubOrder)

    selled_by = models.ForeignKey(User)

The problem is that I want to do views for adding Order model with
possibility to add as many SubOrders as user wants. Currently I solve
this by reading  POST data... ( code:
https://github.com/A3soft/Lisculea/blob/master/Lisculea/Cafe/views.py#L24
and 
https://github.com/A3soft/Lisculea/blob/master/Lisculea/Templates/cafe/order_new.djhtml
)

The problem is that I want users to be able to add SubOrders to Order
object using formset.

So I need to add/select subOrder from the same views as Order, I also
need to display Order formset and be able to edit/add suborders later.
And all SubOrders as their full widget -         <select
name="products" id="id_products"> </select> <input id="quantity"
name="quantity" value="1" size="1" /> and not only as selection for
instance.


So, do you have any ideas how to do this without avoiding a lot of
coding - i mean using django forms and formsets?

-- 
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