Changeset 9084 for src/django_gheat


Ignore:
Timestamp:
Apr 19, 2011, 3:43:22 PM (14 years ago)
Author:
dennisw
Message:

Saves card source (name&type) to database.

File:
1 edited

Legend:

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

    r9080 r9084  
    11#!/usr/bin/env python
     2#
     3###########################################
     4#
     5# Script for importing .netxml files (Kismet output)
     6#
     7# In theory, only the -f option is needed, but for overview's sake, please use the others aswell.
     8# -f = location of the .netxml, e.g. '/home/test.netxml'
     9# -m = name of the dataset, e.g. 'Walk in park' or 'Trip with boat'
     10# -g = your name
     11# -e = your email address
     12#
     13# (Run from project root)
     14# ./manage.py dataimport -f <file location> -m <dataset name> -g <username> -e <email>
     15#
     16# Make sure your file has atleast the following elements:
     17#
     18# <wireless-network>
     19#   <SSID>
     20#     <encryption> </encryption>
     21#     <essid cloaked=""> </essid>
     22#   </SSID>
     23#   <BSSID> </BSSID>
     24#   <gps-info>
     25#     <min-lat> </min-lat>
     26#     <min-lon> </min-lon>
     27#   </gps-info>
     28# </wireless-network>
     29#
     30#
     31# Dennis Wagenaar
     32# d.wagenaar@gmail.com
     33#
     34###########################################
     35
    236from django.core.management import setup_environ
    337from django.core.management.base import BaseCommand
     
    1347  datasource = etree.parse(location)
    1448  doc = datasource.findall('wireless-network')
    15 
     49  kaart = datasource.find('card-source/card-source')
     50  kaart = kaart.text
    1651  g, created = Gebruiker.objects.get_or_create(naam=gebruiker , email=email)
    17   a, created = Apparatuur.objects.get_or_create(antenne='test' , kaart='test')
     52  a, created = Apparatuur.objects.get_or_create(antenne='test' , kaart=kaart)
    1853  mr = MeetRondje.objects.create(datum=datetime.datetime.now() , naam=meetrondje , gebruiker=g , apparatuur=a)
    1954
Note: See TracChangeset for help on using the changeset viewer.