12
12
data = self.cleaned_data.get('attachment_file')
15
14
allowed_types = tuple(settings.ALLOWED_TYPES.split(' '))
18
15
if not data.name.lower().endswith(allowed_types):
19
16
raise forms.ValidationError(_('Filetype not allowed.'))
29
25
fields = ('attachment_file',)
31
27
def save(self, request, obj, *args, **kwargs):
32
29
self.instance.creator = request.user
33
30
self.instance.content_type = ContentType.objects.get_for_model(obj)
34
31
self.instance.object_id = obj.id