Changes for Django 2.0 support

This commit is contained in:
Valentin Samir
2018-04-29 20:10:01 +02:00
parent fcafc77b98
commit 290701e07f
21 changed files with 499 additions and 738 deletions

View File

@ -641,7 +641,7 @@ class Username(models.Model):
#: ForeignKey to a :class:`ServicePattern`. :class:`Username` instances for a
#: :class:`ServicePattern` are accessible thought its :attr:`ServicePattern.usernames`
#: attribute.
service_pattern = models.ForeignKey(ServicePattern, related_name="usernames")
service_pattern = models.ForeignKey(ServicePattern, related_name="usernames", on_delete=models.CASCADE)
def __str__(self):
return self.value
@ -676,7 +676,7 @@ class ReplaceAttributName(models.Model):
#: ForeignKey to a :class:`ServicePattern`. :class:`ReplaceAttributName` instances for a
#: :class:`ServicePattern` are accessible thought its :attr:`ServicePattern.attributs`
#: attribute.
service_pattern = models.ForeignKey(ServicePattern, related_name="attributs")
service_pattern = models.ForeignKey(ServicePattern, related_name="attributs", on_delete=models.CASCADE)
def __str__(self):
if not self.replace:
@ -711,7 +711,7 @@ class FilterAttributValue(models.Model):
#: ForeignKey to a :class:`ServicePattern`. :class:`FilterAttributValue` instances for a
#: :class:`ServicePattern` are accessible thought its :attr:`ServicePattern.filters`
#: attribute.
service_pattern = models.ForeignKey(ServicePattern, related_name="filters")
service_pattern = models.ForeignKey(ServicePattern, related_name="filters", on_delete=models.CASCADE)
def __str__(self):
return u"%s %s" % (self.attribut, self.pattern)
@ -748,7 +748,7 @@ class ReplaceAttributValue(models.Model):
#: ForeignKey to a :class:`ServicePattern`. :class:`ReplaceAttributValue` instances for a
#: :class:`ServicePattern` are accessible thought its :attr:`ServicePattern.replacements`
#: attribute.
service_pattern = models.ForeignKey(ServicePattern, related_name="replacements")
service_pattern = models.ForeignKey(ServicePattern, related_name="replacements", on_delete=models.CASCADE)
def __str__(self):
return u"%s %s %s" % (self.attribut, self.pattern, self.replace)
@ -764,14 +764,14 @@ class Ticket(JsonAttributes):
class Meta:
abstract = True
#: ForeignKey to a :class:`User`.
user = models.ForeignKey(User, related_name="%(class)s")
user = models.ForeignKey(User, related_name="%(class)s", on_delete=models.CASCADE)
#: A boolean. ``True`` if the ticket has been validated
validate = models.BooleanField(default=False)
#: The service url for the ticket
service = models.TextField()
#: ForeignKey to a :class:`ServicePattern`. The :class:`ServicePattern` corresponding to
#: :attr:`service`. Use :meth:`ServicePattern.validate` to find it.
service_pattern = models.ForeignKey(ServicePattern, related_name="%(class)s")
service_pattern = models.ForeignKey(ServicePattern, related_name="%(class)s", on_delete=models.CASCADE)
#: Date of the ticket creation
creation = models.DateTimeField(auto_now_add=True)
#: A boolean. ``True`` if the user has just renew his authentication
@ -1034,7 +1034,7 @@ class Proxy(models.Model):
#: ForeignKey to a :class:`ProxyTicket`. :class:`Proxy` instances for a
#: :class:`ProxyTicket` are accessible thought its :attr:`ProxyTicket.proxies`
#: attribute.
proxy_ticket = models.ForeignKey(ProxyTicket, related_name="proxies")
proxy_ticket = models.ForeignKey(ProxyTicket, related_name="proxies", on_delete=models.CASCADE)
def __str__(self):
return self.url