Ignore:
Timestamp:
Aug 24, 2011, 7:43:40 PM (13 years ago)
Author:
rick
Message:

Some awefull hacks to allow data to be imported.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/gheat/management/commands/import_droidstumbler.py

    r9183 r9552  
    3131
    3232
    33 def import_droidstumbler(location, meetrondje, gebruiker, email, datum,show_progres=False,output=sys.stdout,bulk_import=True):
     33def import_droidstumbler(location, meetrondje, gebruiker, kaart, email, datum,show_progres=False,output=sys.stdout,bulk_import=True):
    3434  """ Import all points, return tuple with summary"""
    3535  g, created = Gebruiker.objects.get_or_create(naam=gebruiker , email=email)
    36   a, created = Apparatuur.objects.get_or_create(antenne='buildin' , kaart='mobilePhone')
     36  a, created = Apparatuur.objects.get_or_create(kaart=kaart)
    3737  mr, created = MeetRondje.objects.get_or_create(datum=datum , naam=meetrondje , gebruiker=g , apparatuur=a)
     38  if not created:
     39    logging.error("Meetrondje '%s' already imported" % mr)
     40    sys.exit(1)
    3841
    3942  meting_count = 0
     
    114117    make_option('-g', '--gebruiker', dest='gebruiker', default=os.environ['USER']),
    115118    make_option('-e', '--email', dest='email', default=os.environ['USER'] + '@example.org'),
     119    make_option('-k', '--kaart', dest='kaart', default='onbekend', help="Kaart gebruikt"),
    116120    make_option('-d', '--datum', dest='datum', default=None, help="Provide date  \
    117121      in following format: %Y-%m-%d-%H%M%S, by default it will be generated from \
     
    146150      self.stdout.write('#INFO: Meetrondje: %s @ %s\n' % (meetrondje, datum))
    147151      self.stdout.write("#INFO: Going to import '%s' for gebruiker '%s <%s>'\n" % (os.path.basename(csv_file), options['gebruiker'], options['email']))
    148       (ap_count, new_ap_count, meting_count, meting_error_count) = import_droidstumbler(csv_file,meetrondje,options['gebruiker'],options['email'], datum, True)
     152      (ap_count, new_ap_count, meting_count, meting_error_count) = import_droidstumbler(csv_file,meetrondje,options['kaart'],options['gebruiker'],options['email'], datum, True)
    149153      self.stdout.write("#INFO: Import summary accespoints: added:%s processed:%s\n" % (new_ap_count, ap_count))
    150154      self.stdout.write("#INFO: Import summary metingen: added:%s error:%s\n" % (meting_count, meting_error_count))
Note: See TracChangeset for help on using the changeset viewer.