I also have a case where I would need to bulk add items from a file, the client receives an excel file with products (up to a couple of hundreds).
I still haven't implemented nothing yet as the feature doesn't have priority, in any case I thought adding a file upload option on the admin, or maybe a bulk add option in manage would make more sense.
in any case I don't think it would be the case of changing your model as you don't need to store this info (the file name).
in any case I believe you would need to add something custom, maybe someone has some kind of template code for bulk adding from file, I believe this could be fairly common.
any thoughts? please update on the path you took.
best luck
avraham
On Tue, Dec 4, 2012 at 5:32 AM, MNG1138 <mark@adperk.com> wrote:
Say I've got a model like this:
class Product(models.Model):class ProductItem(models.Model):name = models.CharField(max_length=200)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 django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment