I should've Googled before speaking. According to http://stackoverflow.com/questions/1499898/django-create-fixtures-without-specifying-a-primary-key by using "pk: null" in fixtures, the primary key will be automatically assigned when saving the object. Great! I'll still do some benchmarking for fun.
On Dec 22, 2:06 pm, Kevin L <kluik...@gmail.com> wrote: > Ahh, I had seen that earlier but disregarded it because it pertained > to CSV files. I see and am reminded now that I can import my project > or app into a python script. My models won't be changing which would > seem to make a good case for fixtures, but at least this way I don't > need to worry about primary keys because of Django's ORM being used. > I'll have to benchmark both approaches and unless fixtures is > extremely faster, I'll probably use a script for the abstraction. > > Thanks Shawn! > > On Dec 22, 1:43 pm, Shawn Milochik <sh...@milochik.com> wrote: > > > > > Well, the data loaded by fixtures will remain, so if you need to add new > > data you'll just have to create and load a fixture with the new data. > > > It's easy to convert data to JSON or whatever, especially if your input > > isn't going to change. > > > However, it seems like maybe you want something else altogether. If you are > > going to be dumping data periodically into a flat file, and then want to > > import it, then I'd use a script that can read that data and create and > > save new instances of your models. > > > Here's a quick & dirty example I put up to illustrate this. It imports from > > a CSV, but you can easily adapt it.http://pastebin.com/f651cf8de > > > Shawn -- 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.