Re: Import models from CSV files?

2009-01-07 Thread Victor Hooi
heya, The sample code request was just me being lazy =). Hmm, so you think the csv parsing code should be in the upload processing? This would just be a form with two boxes for the user to select the .csv files, and an upload button. Better putting it here than in the model? In terms of

Re: Import models from CSV files?

2009-01-07 Thread Keyton Weissinger
Hey Victor, I did the django-batchimport mentioned earlier. I think it will address your need but is definitely aimed at XLS. However, it does already handle duplicates (it will either update them or ignore them based on setting). You can also specify a subset of model fields to use to determine

Re: Import models from CSV files?

2009-01-07 Thread tofergus
On 06.01-16:55, Victor Hooi wrote: [ ... ] > Valts, thanks for the reply - that looks interesting, and is similar > in some ways to what I want - definitely going to check out the code. > Basically, I just wanted a simple file-upload form, for the user to > upload the two .CSV files. Then,

Re: Import models from CSV files?

2009-01-07 Thread Valts Mazurs
Hello, If the file handling job is not too hard I would put the functionality in model. Actually it depends on complexity, use cases and taste. You can try writing the sample code by yourself :) -- Valts On Wed, Jan 7, 2009 at 02:55, Victor Hooi wrote: > > heya, > >

Re: Import models from CSV files?

2009-01-06 Thread Victor Hooi
heya, Whoops...forgot. I'm also confused on the recommended way to deal with duplicates? (not duplicate .csv files, but duplicate entries, perhaps in two different ones.). Just do a plain search for each entry? Or is there a better way? On Jan 7, 11:55 am, Victor Hooi

Re: Import models from CSV files?

2009-01-06 Thread Victor Hooi
heya, Valts, thanks for the reply - that looks interesting, and is similar in some ways to what I want - definitely going to check out the code. Basically, I just wanted a simple file-upload form, for the user to upload the two .CSV files. Then, there's quite a bit of processing to do on the two

Re: Import models from CSV files?

2009-01-06 Thread Valts Mazurs
Hello, Maybe this app could be helpful for you: http://code.google.com/p/django-batchimport/ If you have to import lots of data I would suggest creating python script that reads the files and inserts the data in database either using Django ORM or plain SQL. In case of hundreds of thousands of

Import models from CSV files?

2009-01-05 Thread Victor Hooi
heya, This question might seem a bit simple, but what's the best way to instantiate models from .csv files? Essentially, I have two .csv files. One contains a list of people, and their access rights (one-to-many). The second .csv file contains a log of doorway access (just a bunch of sequential