citavi_mapper/frontend/models.py

37 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
from django.db import models
class Project(models.Model):
name = models.CharField(max_length=255)
description = models.TextField()
associated_filename = models.CharField(max_length=255,blank=True,null=True)
def __unicode__(self):
repr = self.name
if self.associated_filename:
repr += " (" + self.associated_filename + ")"
else:
repr += " (empty)"
return repr
class PersonGlobalIdentity(models.Model):
type = models.CharField(max_length=255)
#TODO: Extend this for further stuff - maybe vivo external url or something?
def __unicode__(self):
repr = "<PersonGlobalIdentity ID=" + str(self.id) + ", type=" + self.type + ">"
return repr
class CitaviProjectIdentity(models.Model):
global_identity = models.ForeignKey(PersonGlobalIdentity)
project_id = models.ForeignKey(Project)
citavi_uuid = models.CharField(max_length=255)
preferred_id = models.BooleanField()
def __unicode__(self):
repr = "<CitaviProjectIdentity project_id=" + str(self.project_id) + ", citavi_uuid=" + self.citavi_uuid + ", global_identity=" + str(self.global_identity) + ", preferred=" + str(self.preferred_id) + ">"
return repr