Modern responsive template for the Django admin interface with improved functionality. We are proud to announce completely new Jet. Please check out Live Demo
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
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
'admin.py
'models.py