87 lines
4.0 KiB
Python
87 lines
4.0 KiB
Python
# -*- coding: utf-8 -*-2
|
|
from django.db import models
|
|
|
|
|
|
class Project(models.Model):
|
|
""" Model representing a citavi project. """
|
|
name = models.CharField(max_length=255)
|
|
description = models.TextField()
|
|
associated_filename = models.CharField(max_length=255, blank=True, null=True)
|
|
|
|
def __unicode__(self):
|
|
temp = unicode(self.name)
|
|
if self.associated_filename:
|
|
temp += u" (" + unicode(self.associated_filename) + u")"
|
|
else:
|
|
temp += u" (No project file)"
|
|
return temp
|
|
|
|
class Presentation(models.Model):
|
|
""" Presention Model for PresentationForm"""
|
|
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')
|
|
|
|
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)
|
|
|
|
class PresentationEvent(models.Model):
|
|
"""Veranstaltung"""
|
|
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)
|
|
|
|
class PresentationPerson(models.Model):
|
|
""" Person Model for PresentationForm"""
|
|
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')
|
|
presentation = models.ForeignKey(Presentation, blank=False, null=False, db_index=True)
|
|
|
|
|
|
class PersonGlobalIdentity(models.Model):
|
|
""" Model representing a global person identity in django. Can be used to link any foreign identity to it. """
|
|
type = models.CharField(max_length=255)
|
|
# TODO: Extend this for further stuff - maybe vivo external url or something?
|
|
|
|
def __unicode__(self):
|
|
from service.Mapper import person_mapper
|
|
return person_mapper.get_representation_for_global_identity(self) + u" [" u"ID=" + unicode(self.id) + u", Type=" + unicode(self.type) + u"]"
|
|
|
|
|
|
class CitaviProjectIdentity(models.Model):
|
|
""" Model representing an identity from a citavi project. """
|
|
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)
|
|
preferred = models.BooleanField()
|
|
|
|
def __unicode__(self):
|
|
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>"
|
|
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()
|
|
|