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.core.mail import send_mail
30 from django.db import models
31 from django.db import transaction
32 from django.utils.translation import ugettext_lazy as _
33 from django.template.loader import render_to_string
35 #from django.core.validators import validate_email
38 from django.contrib.auth import get_user_model
39 User = get_user_model()
41 from django.contrib.auth.models import User
44 from django.utils.timezone import now as datetime_now
46 datetime_now = datetime.datetime.now
48 SHA1_RE = re.compile('^[a-f0-9]{40}$')
50 # Create your models here.
52 class Institution(models.Model):
53 name = models.TextField()
54 # list of associated email domains
56 class PendingUser(models.Model):
57 # NOTE We might consider migrating the fields to CharField, which would
58 # simplify form creation in forms.py
59 first_name = models.TextField()
60 last_name = models.TextField()
61 # affiliation = models.TextField()
62 email = models.EmailField() #validators=[validate_email])
63 password = models.TextField()
64 keypair = models.TextField()
66 authority_hrn = models.TextField()
67 # models.ForeignKey(Institution)
69 class PendingSlice(models.Model):
70 slice_name = models.TextField()
71 authority_hrn = models.TextField(null=True)
72 number_of_nodes = models.TextField(default=0)
73 type_of_nodes = models.TextField(default='NA')
74 purpose = models.TextField(default='NA')