mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-27 01:31:57 +00:00
625b2156e3
- Import is now non-destructive - Parsers write output to a log file (path be specified in settings) - databaseReset.py content been divided into separate functions which can be called for varying levels of deletion and importing - control panel (view, template, urlpattern) added for deleting and importing - Logins and signup fixed - CaveArea model updated, view, hierarchical url patterns, and beginning of template added - New site style Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8324 by cucc @ 5/3/2009 5:56 AM
10 lines
437 B
Python
10 lines
437 B
Python
def save(objectType, lookupAttribs={}, nonLookupAttribs={}):
|
|
|
|
instance, created=objectType.objects.get_or_create(defaults=nonLookupAttribs, **lookupAttribs)
|
|
|
|
if not created and not instance.new_since_parsing:
|
|
for k, v in nonLookupAttribs.items(): #overwrite the existing attributes from the logbook text (except date and title)
|
|
setattr(instance, k, v)
|
|
instance.save()
|
|
|
|
return instance |