mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-11-04 09:12:11 +01:00 
			
		
		
		
	front improvement on alias page
This commit is contained in:
		@@ -12,8 +12,12 @@ class AliasForm(forms.ModelForm):
 | 
			
		||||
    class Meta:
 | 
			
		||||
        model = Alias
 | 
			
		||||
        fields = ("name",)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def __init__(self,*args,**kwargs):
 | 
			
		||||
        super().__init__(*args,**kwargs)
 | 
			
		||||
        self.fields["name"].label = False
 | 
			
		||||
        self.fields["name"].widget.attrs={"placeholder":_('New Alias')}
 | 
			
		||||
        
 | 
			
		||||
        
 | 
			
		||||
class TransactionTemplateForm(forms.ModelForm):
 | 
			
		||||
    class Meta:
 | 
			
		||||
        model = TransactionTemplate
 | 
			
		||||
 
 | 
			
		||||
@@ -227,12 +227,13 @@ class Alias(models.Model):
 | 
			
		||||
        try:
 | 
			
		||||
            sim_alias = Alias.objects.get(normalized_name=normalized_name)
 | 
			
		||||
            if self != sim_alias:
 | 
			
		||||
                raise ValidationError(_('An alias with a similar name already exists:'),
 | 
			
		||||
                raise ValidationError(_('An alias with a similar name already exists: {} '.format(sim_alias)),
 | 
			
		||||
                                       code="same_alias"
 | 
			
		||||
                )
 | 
			
		||||
        except Alias.DoesNotExist:
 | 
			
		||||
            pass
 | 
			
		||||
 | 
			
		||||
        self.normalized_name = normalized_name
 | 
			
		||||
        
 | 
			
		||||
    def delete(self, using=None, keep_parents=False):
 | 
			
		||||
        if self.name == str(self.note):
 | 
			
		||||
            raise ValidationError(_("You can't delete your main alias."),
 | 
			
		||||
 
 | 
			
		||||
@@ -32,8 +32,14 @@ class AliasTable(tables.Table):
 | 
			
		||||
            'table table condensed table-striped table-hover'
 | 
			
		||||
        }
 | 
			
		||||
        model = Alias
 | 
			
		||||
        fields = ('name','pk')
 | 
			
		||||
        fields =('name',)
 | 
			
		||||
        template_name = 'django_tables2/bootstrap4.html'
 | 
			
		||||
 | 
			
		||||
    delete = tables.LinkColumn('member:user_alias_delete', args=[A('pk')], attrs={
 | 
			
		||||
        'a': {'class': 'btn btn-danger'} },text='delete',accessor='pk')
 | 
			
		||||
    show_header = False
 | 
			
		||||
    name = tables.Column(attrs={'td':{'class':'text-center'}})
 | 
			
		||||
    delete = tables.LinkColumn('member:user_alias_delete',
 | 
			
		||||
                               args=[A('pk')],
 | 
			
		||||
                               attrs={
 | 
			
		||||
                                   'td': {'class':'col-sm-2'},
 | 
			
		||||
                                   'a': {'class': 'btn btn-danger'} },
 | 
			
		||||
                               text='delete',accessor='pk')
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user