source: src/django_gheat/gheat/dataimport.py@ 9060

Last change on this file since 9060 was 9050, checked in by dennisw, 14 years ago

Data import toevoegingen.

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/usr/bin/env python
2from django.core.management import setup_environ
3import settings
4setup_environ(settings)
5from xml.dom.minidom import parse
6from gheat.models import *
7
8datasource = open('/home/dennis/Desktop/test.netxml')
9dom = parse(datasource)
10
11for wnetwork in dom.getElementsByTagName('wireless-network'):
12 for bssid in wnetwork.getElementsByTagName('BSSID'):
13 bssid = bssid.firstChild.nodeValue
14 print bssid
15 for manuf in wnetwork.getElementsByTagName('manuf'):
16 manuf = manuf.firstChild.nodeValue
17 print manuf
18 for enc in wnetwork.getElementsByTagName('encryption'):
19 enc = enc.firstChild.nodeValue
20 print enc
21 for ssid in wnetwork.getElementsByTagName('ssid'):
22 ssid = ssid.firstChild.nodeValue
23 print ssid
24 for lat in wnetwork.getElementsByTagName('min-lat'):
25 lat = lat.firstChild.nodeValue
26 print lat
27 for lon in wnetwork.getElementsByTagName('min-lon'):
28 lon = lon.firstChild.nodeValue
29 print lon
30
31 g = Gebruiker(naam= , email= )
32 g.save()
33 a = Apparatuur(antenne= , kaart= )
34 a.save()
35 mr = MeetRondje(datum= , naam= , gebruiker_id=g.id , apparatuur_id=a.id )
36 mr.save()
37 ap = Accespoint(mac= , ssid= , encryptie= )
38 ap.save()
39 m = Meting(meetrondje_id=mr.id, accespoint_id=ap.id, latitude= , longitude= , signaal= )
40 m.save()
41
42
Note: See TracBrowser for help on using the repository browser.