X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/967eed676fc83d15b26149047f353ac61faa8217..eaf0711613bea8181528d8911b30ef7976b7bb42:/src/contact/models.py diff --git a/src/contact/models.py b/src/contact/models.py index e44bd9bb0..aae3f2dcd 100644 --- a/src/contact/models.py +++ b/src/contact/models.py @@ -1,7 +1,7 @@ -# -*- coding: utf-8 -*- import yaml from hashlib import sha1 from django.db import models +from django.urls import reverse from django.utils.encoding import smart_text from django.utils.translation import ugettext_lazy as _ from jsonfield import JSONField @@ -49,13 +49,12 @@ class Contact(models.Model): class Attachment(models.Model): - contact = models.ForeignKey(Contact) + contact = models.ForeignKey(Contact, models.CASCADE) tag = models.CharField(max_length=64) file = models.FileField(upload_to='contact/attachment') - @models.permalink def get_absolute_url(self): - return 'contact_attachment', [self.contact_id, self.tag] + return reverse('contact_attachment', args=[self.contact_id, self.tag]) __import__(app_settings.FORMS_MODULE)