Good day.
I’m building an application for ordering prints and struggles at a part where
the user, apart from selecting from predefined values, can enter her own data for printing.
Consider the following:
class PrintItem(models.Model):
""" Something printable. Poster, t-shirt, mug, etc """
name = models.CharField(max_length=20)
class AttributeType(models.Model):
""" Size,colour, etc """
name = models.CharField(max_length=20)
class Attribute(models.Model):
""" Size: A4, A5 | Colour: Violet, Black """
name = models.CharField(max_length=20)
type = models.ForeignKey(AttributeType)
# And a join model
class PrintAttribute(models.Model):
print_item = models.ForeignKey(PrintItem)
attributes = models.ManyToManyField(Attribute)
# The user adds these to a cart
class Cart(models.Model):
user = models.ForeignKey(User)
class CartItem(models.Model):
cart = models.ForeignKey(Cart)
print_item = models.ForeignKey(PrintItem)
This works all good. The user can select from the predefined attributes, but how and where would you suggest I would implement the user input functionality?
User finds an item to print, chooses from the predefined Attributes (print size, the ink colour) and can enter her own message/slogan to print on the item.
Grateful for any suggestions.
If user’s own slogan/message gets entered only upon adding a print item to the cart, then the slogan/message should be a field of
CartItem.