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 files, currently in a small python script.
My question was more along the lines of where should put all of the logic? Should it be in the model itself, somewhere, and the file- upload form just passes across the raw data from the .csv files? Where would the file-handling stuff go? Is it easier to do it via raw SQL, or via the django models? Any chance of sample code =)? Cheers, Victor On Jan 6, 7:05 pm, "Valts Mazurs" <vald...@gmail.com> wrote: > 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 rows I would commit > the changes to database after number of inserts (e.g., 100) instead of every > insert. > > Best regards, > -- > Valts > > On Tue, Jan 6, 2009 at 07:02, Victor Hooi <victorh...@yahoo.com> wrote: > > > 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 lines). I have a simple > > python script which imports these two .csv files, does some processing > > (the files are quite messy), creates user and access-entry objects, > > and produces a reconciliation with a list of exceptions (basically > > door entries which aren't in the list of user/access rights). Each > > user is just a dictionary, with their username as key, and a tuple of > > dictionary objects for their various access rights. > > > I would like a simple django project to import these logs, instantiate > > models, and then basically manage it via the in-built admin interface, > > hopefully saving a lot of time =). (will also need to deal with > > duplicates). Is there a smart way to go about doing this project, or > > any existing addons I can leverage off? > > > Thanks, > > Victor --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---