Say I've got a model like this:
class Product(models.Model):
name = models.CharField(max_length=200)
class ProductItem(models.Model):
product = models.ForeignKey(Product)
serialnumber = models.charField()
sold = models.BooleanField(default=False)
ProductItem represents physical products in the store. I have a file with
thousands of serial #'s for the product. In the product form in the admin,
I'd like to upload this file, parse the serial #'s and create rows in
ProductItem. I could add a FileField to Product and create a custom
storage that parses the file and creates ProductITems. Or I could override
save for the Product model. Both of these solutions are non-optimal, as I
will have a FileField in Product and db that I don't need.
Is there any way to add a 'dummy' FileField just for the form that doesn't
result in a DB row? Or is the answer to create a custom admin form? Any
good tutorials or examples for doing creating a custom admin form?
Thanks,
Mark
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/efDj8ZO4QXIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.