Esempio n. 1
0
    def clean(self, *args, **kwargs):
        cd = super(LabelForm, self).clean()

        try:
            parent = cd['parent']
            if not parent.pk:
                parent.creator = self.user
                parent.save()
        except:
            pass

        try:
            if parent.pk == self.instance.pk:
                self._errors["parent"] = self.error_class([_('The parent label can not be itself!')])
        except:
            pass


        try:
            tree_id = getattr(self.instance, 'tree_id')
            new_tree_id = getattr(parent, 'tree_id')
            if tree_id == new_tree_id:
                pass
                #self._errors["parent"] = self.error_class([_('Parent error. Try to select a valid Label in the dropdown.')])
        except:
            pass


        
        if cd.get('remote_image', None):
            remote_file = get_file_from_url(cd['remote_image'])
            if remote_file:
                cd['main_image'] = remote_file

        return cd
Esempio n. 2
0
    def clean(self, *args, **kwargs):

        cd = super(ArtistForm, self).clean()

        if cd.get('remote_image', None):
            remote_file = get_file_from_url(cd['remote_image'])
            if remote_file:
                cd['main_image'] = remote_file

        return cd
Esempio n. 3
0
    def clean(self, *args, **kwargs):

        cd = super(ArtistForm, self).clean()

        if cd.get('remote_image', None):
            remote_file = get_file_from_url(cd['remote_image'])
            if remote_file:
                cd['main_image'] = remote_file

        return cd
    def clean(self, *args, **kwargs):

        cd = super(ReleaseForm, self).clean()

        try:
            label = cd['label']
            if not label.pk:
                label.creator = self.user
                label.save()
        except:
            pass

        if cd.get('remote_image', None):
            remote_file = get_file_from_url(cd['remote_image'])
            if remote_file:
                cd['main_image'] = remote_file

        return cd
Esempio n. 5
0
    def clean(self, *args, **kwargs):
        cd = super(LabelForm, self).clean()

        try:
            parent = cd['parent']
            if not parent.pk:
                parent.creator = self.user
                parent.save()
        except:
            pass

        try:
            if parent.pk == self.instance.pk:
                self._errors["parent"] = self.error_class([_('The parent label can not be itself!')])
        except:
            pass

        if cd.get('remote_image', None):
            remote_file = get_file_from_url(cd['remote_image'])
            if remote_file:
                cd['main_image'] = remote_file

        return cd