2014-11-26 11:28:56 +01:00
|
|
|
# -*- coding: utf-8 -*-2
|
2014-07-25 11:20:10 +02:00
|
|
|
from django.db import models
|
|
|
|
|
2014-12-10 16:28:21 +01:00
|
|
|
|
2014-08-11 16:01:03 +02:00
|
|
|
class Project(models.Model):
|
2014-09-29 13:40:07 +02:00
|
|
|
""" Model representing a citavi project. """
|
2014-07-28 13:20:13 +02:00
|
|
|
name = models.CharField(max_length=255)
|
|
|
|
description = models.TextField()
|
2014-09-19 11:05:14 +02:00
|
|
|
associated_filename = models.CharField(max_length=255, blank=True, null=True)
|
|
|
|
|
2014-07-28 13:20:13 +02:00
|
|
|
def __unicode__(self):
|
2014-09-29 15:01:35 +02:00
|
|
|
temp = unicode(self.name)
|
2014-07-28 13:20:13 +02:00
|
|
|
if self.associated_filename:
|
2014-09-29 15:01:35 +02:00
|
|
|
temp += u" (" + unicode(self.associated_filename) + u")"
|
2014-08-11 16:01:03 +02:00
|
|
|
else:
|
2014-10-01 11:26:11 +02:00
|
|
|
temp += u" (No project file)"
|
2014-09-29 15:01:35 +02:00
|
|
|
return temp
|
2014-09-15 16:32:23 +02:00
|
|
|
|
2014-11-26 11:56:18 +01:00
|
|
|
class Presentation(models.Model):
|
|
|
|
""" Presention Model for PresentationForm"""
|
2014-12-11 15:47:47 +01:00
|
|
|
title = models.CharField(max_length=255, verbose_name='Titel')
|
|
|
|
type = models.CharField(max_length=255, choices=((u'main', u'Hauptvortrag'), (u'other', u'andere Veranstaltung')), default=u'main', verbose_name='Veranstaltungstyp')
|
|
|
|
abstract = models.TextField(verbose_name=u'Zusammenfassung')
|
|
|
|
|
2014-12-11 16:30:54 +01:00
|
|
|
def __unicode__(self):
|
|
|
|
return self.title
|
|
|
|
|
2014-12-11 15:47:47 +01:00
|
|
|
class PresentationSubmission(models.Model):
|
|
|
|
""" Submission containing a Presentation """
|
|
|
|
email = models.EmailField(max_length=255, verbose_name='E-Mail Adresse')
|
|
|
|
comment = models.TextField(verbose_name=u'Kommentar')
|
|
|
|
presentation = models.ForeignKey(Presentation, blank=False, null=False, db_index=True)
|
2014-11-26 11:56:18 +01:00
|
|
|
|
2014-12-11 16:30:54 +01:00
|
|
|
def __unicode__(self):
|
|
|
|
return self.email
|
|
|
|
|
|
|
|
|
2014-12-03 09:18:13 +01:00
|
|
|
class PresentationEvent(models.Model):
|
|
|
|
"""Veranstaltung"""
|
2014-12-11 15:47:47 +01:00
|
|
|
date = models.DateField(verbose_name='Veranstaltungsdatum')
|
|
|
|
name = models.CharField(max_length=255, verbose_name='Name')
|
|
|
|
workshop = models.BooleanField(verbose_name='Workshop')
|
|
|
|
place = models.CharField(max_length=255, verbose_name='Ort')
|
|
|
|
start_date = models.DateField(verbose_name='Startdatum')
|
|
|
|
end_date = models.DateField(verbose_name='Enddatum')
|
|
|
|
presentation = models.ForeignKey(Presentation, blank=False, null=False, db_index=True)
|
2014-12-10 16:28:21 +01:00
|
|
|
|
2014-12-11 16:30:54 +01:00
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
2014-11-26 11:28:56 +01:00
|
|
|
class PresentationPerson(models.Model):
|
|
|
|
""" Person Model for PresentationForm"""
|
2014-12-11 15:47:47 +01:00
|
|
|
given_name = models.CharField(max_length=255, verbose_name='Vorname')
|
|
|
|
additional_name = models.CharField(max_length=255, verbose_name='Namenszusatz', blank=True)
|
|
|
|
family_name = models.CharField(max_length=255, verbose_name='Nachname')
|
|
|
|
hshmembership = models.CharField(max_length=255, choices=((u'yes', u'Ja'), (u'no', u'Nein'), (u'maybe', u'Maybe')), default=u'maybe', verbose_name='Hochschulangehörigkeit')
|
2014-11-26 11:56:18 +01:00
|
|
|
presentation = models.ForeignKey(Presentation, blank=False, null=False, db_index=True)
|
|
|
|
|
2014-12-11 16:30:54 +01:00
|
|
|
def __unicode__(self):
|
|
|
|
return self.given_name + ' ' + self.family_name
|
|
|
|
|
2014-09-15 16:32:23 +02:00
|
|
|
|
|
|
|
class PersonGlobalIdentity(models.Model):
|
2014-09-29 13:40:07 +02:00
|
|
|
""" Model representing a global person identity in django. Can be used to link any foreign identity to it. """
|
2014-09-15 16:32:23 +02:00
|
|
|
type = models.CharField(max_length=255)
|
2014-09-19 11:05:14 +02:00
|
|
|
# TODO: Extend this for further stuff - maybe vivo external url or something?
|
2014-09-15 16:32:23 +02:00
|
|
|
|
|
|
|
def __unicode__(self):
|
2014-09-29 18:17:38 +02:00
|
|
|
from service.Mapper import person_mapper
|
2014-10-01 11:26:11 +02:00
|
|
|
return person_mapper.get_representation_for_global_identity(self) + u" [" u"ID=" + unicode(self.id) + u", Type=" + unicode(self.type) + u"]"
|
2014-09-15 16:32:23 +02:00
|
|
|
|
|
|
|
|
2014-09-25 17:36:42 +02:00
|
|
|
class CitaviProjectIdentity(models.Model):
|
2014-09-29 13:40:07 +02:00
|
|
|
""" Model representing an identity from a citavi project. """
|
2014-09-29 16:51:50 +02:00
|
|
|
global_identity = models.ForeignKey(PersonGlobalIdentity, blank=True, null=True, db_index=True)
|
|
|
|
project = models.ForeignKey(Project, blank=False, null=False, db_index=True)
|
|
|
|
citavi_uuid = models.CharField(max_length=255, blank=False, null=False, db_index=True)
|
2014-09-19 11:52:56 +02:00
|
|
|
preferred = models.BooleanField()
|
2014-09-19 11:05:14 +02:00
|
|
|
|
2014-09-15 16:32:23 +02:00
|
|
|
def __unicode__(self):
|
2014-10-01 11:26:11 +02:00
|
|
|
from service.Mapper import person_mapper
|
|
|
|
citavi_repr = person_mapper.get_representation_for_citavi_identity(self)
|
|
|
|
if self.preferred == True:
|
|
|
|
citavi_repr = citavi_repr + u" <preferred>"
|
2014-10-10 15:16:14 +02:00
|
|
|
return citavi_repr
|
|
|
|
|
|
|
|
# TODO: Figure out how to realize this step by step. PROPERLY!
|
|
|
|
|
|
|
|
class HSHIdentity(models.Model):
|
|
|
|
""" Model representing existing HSH identities. """
|
|
|
|
global_identity = models.ForeignKey(PersonGlobalIdentity, blank=True, null=True, db_index=True)
|
|
|
|
preferred = models.BooleanField()
|
|
|
|
|
|
|
|
|
|
|
|
class VIVOIdentity(models.Model):
|
|
|
|
""" Model representing existing VIVO identities. """
|
|
|
|
global_identity = models.ForeignKey(PersonGlobalIdentity, blank=True, null=True, db_index=True)
|
|
|
|
preferred = models.BooleanField()
|
|
|
|
|