root / core / models.py @ edf7ec0f
History | View | Annotate | Download (1.8 kB)
1 |
# -*- coding: utf-8 -*- vim:encoding=utf-8:
|
---|---|
2 |
# vim: tabstop=4:shiftwidth=4:softtabstop=4:expandtab
|
3 |
#
|
4 |
#Copyright © 2013 Greek Research and Technology Network (GRNET S.A.)
|
5 |
#
|
6 |
#Developed by Leonidas Poulopoulos (leopoul-at-noc-dot-grnet-dot-gr) and
|
7 |
#George Kargiotakis (kargig-at-noc-dot-grnet-dot-gr), GRNET NOC
|
8 |
#
|
9 |
#Permission to use, copy, modify, and/or distribute this software for any
|
10 |
#purpose with or without fee is hereby granted, provided that the above
|
11 |
#copyright notice and this permission notice appear in all copies.
|
12 |
#
|
13 |
#THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
|
14 |
#TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
15 |
#FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
16 |
#CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
17 |
#DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
18 |
#ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
19 |
#SOFTWARE.
|
20 |
|
21 |
from django.db import models |
22 |
|
23 |
|
24 |
from taggit.managers import TaggableManager |
25 |
|
26 |
class Lun(models.Model): |
27 |
name = models.CharField(max_length=80)
|
28 |
tags = TaggableManager(blank=True)
|
29 |
|
30 |
|
31 |
def __unicode__(self): |
32 |
return 'ID: %s, Name: %s' % (self.pk, self.name) |
33 |
|
34 |
def getGraphs(self): |
35 |
lungraphs = Graph.objects.filter(tags__name='lun:%s'%self.pk) |
36 |
return lungraphs
|
37 |
|
38 |
def gettags(self): |
39 |
alltags = ",".join([tag.name for tag in self.tags.all()]) |
40 |
return alltags
|
41 |
gettags.allow_tags = True
|
42 |
gettags.short_description = 'Tags'
|
43 |
|
44 |
|
45 |
class Query(models.Model): |
46 |
name = models.CharField(max_length=80)
|
47 |
lunquery = models.CharField('Query', max_length=765) |
48 |
|
49 |
def __unicode__(self): |
50 |
return '%s' % (self.name) |
51 |
|
52 |
|
53 |
from graphs.models import * |
54 |
|
55 |
|