1 # -*- coding: utf-8 -*-
3 # portal/models.py: models for the portal application
4 # This file is part of the Manifold project.
7 # Jordan Augé <jordan.auge@lip6.fr>
8 # Copyright 2013, UPMC Sorbonne Universités / LIP6
10 # This program is free software; you can redistribute it and/or modify it under
11 # the terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 3, or (at your option) any later version.
14 # This program is distributed in the hope that it will be useful, but WITHOUT
15 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 # You should have received a copy of the GNU General Public License along with
20 # this program; see the file COPYING. If not, write to the Free Software
21 # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 from django.conf import settings
29 from django.db import models
30 from django.db import transaction
31 from django.utils.translation import ugettext_lazy as _
32 from django.template.loader import render_to_string
34 #from django.core.validators import validate_email
37 from django.contrib.auth import get_user_model
38 User = get_user_model()
40 from django.contrib.auth.models import User
43 from django.utils.timezone import now as datetime_now
45 datetime_now = datetime.datetime.now
47 SHA1_RE = re.compile('^[a-f0-9]{40}$')
49 # Create your models here.
51 class Institution(models.Model):
52 name = models.TextField()
53 # list of associated email domains
55 class PendingUser(models.Model):
56 # NOTE We might consider migrating the fields to CharField, which would
57 # simplify form creation in forms.py
58 first_name = models.TextField()
59 last_name = models.TextField()
60 email = models.EmailField() #validators=[validate_email])
61 password = models.TextField()
62 user_hrn = models.TextField()
63 public_key = models.TextField()
64 private_key = models.TextField()
65 authority_hrn = models.TextField()
66 login = models.TextField()
67 pi = models.TextField()
68 email_hash = models.TextField()
69 status = models.TextField()
70 created = models.DateTimeField(auto_now_add = True)
71 # models.ForeignKey(Institution)
73 class PendingAuthority(models.Model):
74 site_name = models.TextField()
75 site_authority = models.TextField()
76 site_abbreviated_name = models.TextField()
77 site_url = models.TextField()
78 site_latitude = models.TextField()
79 site_longitude = models.TextField()
80 address_line1 = models.TextField()
81 address_line2 = models.TextField()
82 address_line3 = models.TextField()
83 address_city = models.TextField()
84 address_postalcode = models.TextField()
85 address_state = models.TextField()
86 address_country = models.TextField()
87 # parent authority of the requested authority
88 authority_hrn = models.TextField()
89 created = models.DateTimeField(auto_now_add = True)
91 class PendingSlice(models.Model):
92 slice_name = models.TextField()
93 user_hrn = models.TextField()
94 authority_hrn = models.TextField(null=True)
95 number_of_nodes = models.TextField(default=0)
96 type_of_nodes = models.TextField(default='NA')
97 purpose = models.TextField(default='NA')
98 created = models.DateTimeField(auto_now_add = True)