Jirka

I need an easy method inside the admin to upload the csv file with an
web interface. I guess with your method the admin will need access to
the server and the command line, and something like this is not what i
try to do, because the admin (not me) is not a django developer, not
even a user get used to command lines. But if my guessing is wrong how
can i do a web interface for your method?

Regards!

On Oct 29, 5:44 am, Jirka Vejrazka <jirka.vejra...@gmail.com> wrote:
> I must still be missing something here. If all you want to do is to
> read CSV file and save the data in the database, I still don't
> understand why you use the forms machinery.
>
> You only *need* to use the data model, e.g.
>
> from myapp.models import Data
>
> csvfile = csv.reader('something.csv')
>
> for line in csvfile:
>   do_necessary_data_conversions_or_checks(line)
>   try:
>     Data.objects.create(field1=line[0], field2=line[1], ...)
>   except (IndexError, IntegrityError):
>     print 'Invalid line encountered:\n%s' % line
>
>   What am I missing?
>
>    Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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