Basraah 786859294d Restructure Alliance Auth package (#867)
* Refactor allianceauth into its own package

* Add setup

* Add missing default_app_config declarations

* Fix timerboard namespacing

* Remove obsolete future imports

* Remove py2 mock support

* Remove six

* Add experimental 3.7 support and multiple Dj versions

* Remove python_2_unicode_compatible

* Add navhelper as local package

* Update requirements
2017-09-19 09:46:40 +10:00

37 lines
1.1 KiB
Python

from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
from allianceauth.eveonline.models import EveCharacter
def get_sentinel_user():
return User.objects.get_or_create(username='deleted')[0]
class Fatlink(models.Model):
fatdatetime = models.DateTimeField(default=timezone.now)
duration = models.PositiveIntegerField()
fleet = models.CharField(max_length=254, default="")
name = models.CharField(max_length=254)
hash = models.CharField(max_length=254, unique=True)
creator = models.ForeignKey(User, on_delete=models.SET(get_sentinel_user))
def __str__(self):
return self.name
class Fat(models.Model):
character = models.ForeignKey(EveCharacter, on_delete=models.CASCADE)
fatlink = models.ForeignKey(Fatlink)
system = models.CharField(max_length=30)
shiptype = models.CharField(max_length=30)
station = models.CharField(max_length=125)
user = models.ForeignKey(User)
class Meta:
unique_together = (('character', 'fatlink'),)
def __str__(self):
return "Fat-link for %s" % self.character.character_name