Hi there,

I am trying to use django-batchimport that I got from
http://code.google.com/p/django-batchimport/ It's function is to allow
for importing/exporting of data from excel into and out of django
models. There is no documentation on the new version(which is still
not so new). I am hoping other people are using this and can help me
understand how to use it. There is a demo project that one can get off
the app website but it's quite simple and once you have a model
slightly more complicated then it's very difficult to understand what
to do.

Can someone explain to me how to properly how to use the import_dict
line for line? ( How to create the 'object_colmap' and
'relationship_colmap'

For example how would I build up an import_dict for this model? It has
many ForeignKeys, A ManyToMany, DecimalFields and Datetime.
I've tried but run into errors such as "Cannot convert float to
Decimal, convert float to string first" "Too many values to unpack"
and "Expected string but tuple was passed".

class Recipe(models.Model):
    EASY_STATUS = 1
    MEDIUM_STATUS = 2
    HARD_STATUS = 3
    DIFFICULTY_CHOICES = (
        (EASY_STATUS, 'For the novice'),
        (MEDIUM_STATUS, 'So you know how to cook'),
        (HARD_STATUS, 'Food is art'),
        )

    title = models.CharField(max_length=200, help_text='Recipe Name')
    description = models.TextField(help_text='Recipe description or
teaser')
    serves = models.PositiveSmallIntegerField()
    slug = models.SlugField(help_text='This field is automatically
populated from the Title')
    difficulty = models.IntegerField(choices=DIFFICULTY_CHOICES,
default=EASY_STATUS)
    prep_time = models.DecimalField(decimal_places=2, max_digits=10)
    cooking_time = models.DecimalField(decimal_places=2,
max_digits=10)
    vegetarian = models.BooleanField()
    instructions = models.TextField(help_text='Cooking method')
    categories = models.ForeignKey(Category)
    tags = TagField(help_text='Tags are seperated by a space')
    vat = models.ForeignKey(Vat)
    markup = models.ForeignKey(Markup)
    albums = models.ManyToManyField('albums')
    created_on = models.DateTimeField('date created',
auto_now_add=True)

Thank you very much.

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