-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
53 lines (47 loc) · 1.48 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import dbMethods
import managers
class GephiNode:
""" The Class for the nodes of the twitter network
"""
def __init__(self, id, label, fan_count, handle):
self.id = id
self.label = label
self.fan_count = fan_count
self.handle = handle
def create(self):
if len(GephiNode.objects.filter(handle=self.handle)) == 0:
dbMethods.dynamic_data_entry_Nodes(
self.id,
self.label,
self.fan_count,
self.handle
)
else:
print('Already exists')
node = GephiNode.objects.get(handle=self.handle)
self.id = node.id
self.label =node.label
self.fan_count = node.fan_count
self.handle = node.handle
objects = managers.GephiNodeManager()
class GephiEdge:
""" The Class for the edge of the twitter network
"""
def __init__(self, source, target, type, id, weight):
self.source = source
self.target = target
self.type = type
self.id = id
self.weight = weight
def create(self):
if len(GephiEdge.objects.filter(source=self.source, target=self.target)) == 0:
dbMethods.dynamic_data_entry_Edges(
self.source,
self.target,
self.type,
self.id,
self.weight
)
else:
print('Already exists')
objects = managers.GephiEdgeManager()