geex-arts / django-jet

Modern responsive template for the Django admin interface with improved functionality. We are proud to announce completely new Jet. Please check out Live Demo
https://github.com/jet-admin/jet-bridge
GNU Affero General Public License v3.0
3.57k stars 776 forks source link

CheckboxSelectMultiple, difficult to use #153

Open wcreis opened 7 years ago

wcreis commented 7 years ago

Hello, I have an implementation of 'CheckboxSelectMultiple', in the Django admin, for a ManyToManyField relationship, however to use it has to doubleclick and hold CTRL. Is there any better way to usability? Sorry if this is a default behavior for Component.

My code. 'forms.py

class IgrejaAdminForm(ModelForm):
    class Meta:
        model = Igreja
        fields = ('nome_da_comum', 'dias_de_culto')
        widgets = {
            'dias_de_culto': CheckboxSelectMultiple,
        }

'admin.py

class IgrejaAdmin(admin.ModelAdmin):
    form = IgrejaAdminForm
    list_display = [
        'nome_da_comum',
        'get_dias_culto'
    ]

'models.py

class Igreja(models.Model):
    nome_da_comum = models.CharField(max_length=255)
    dias_de_culto = models.ManyToManyField(DiaCulto,
                                           verbose_name='Dias de Culto')

    class Meta:
        verbose_name = "Igreja"
        verbose_name_plural = "Igrejas"

    def get_dias_culto(self):
        return "\n".join([d.legenda for d in self.dias_de_culto.all()])

    get_dias_culto.short_description = 'Dias de Culto'

    def __str__(self):
        return self.nome_da_comum
ph87 commented 7 years ago

Totally agreen with you, it is really hard to use.

Ismael-VC commented 7 years ago

Please come to the django-jet Discord server so we can organize if you like:

Welcome! 😄