Type error when changing model object in admin

When I try to change an object in django admin, I get a Type error. This happens with all the objects of that model, but not with other models. I suspect there is something wrong in my model, or at least something that django admin doesn't appreciate. Here is the error:

TypeError at /admin/events/evenement/10/change/
type object argument after ** must be a mapping, not QuerySet
Request Method: GET
Request URL:
Django Version: 4.1.5
Exception Type: TypeError
Exception Value:    
type object argument after ** must be a mapping, not QuerySet

This is my model

class Evenement(models.Model):
    name = models.CharField(max_length=50)
    url_name = models.SlugField(max_length=50, blank=True)
    datum = models.DateField()
    locatie = models.CharField(max_length=100)
    omschrijving = models.TextField()
    evenement_type = models.ForeignKey(EvenementType, on_delete=models.PROTECT)
    ideal = models.BooleanField()
    aantal_honden_toegestaan = models.IntegerField(default=2)
    annuleren_toegestaan = models.BooleanField(default=True)
    alleen_flatcoat = models.BooleanField(default=False)
    secretariaat = models.ForeignKey(Group, on_delete=models.PROTECT, limit_choices_to=limit_secretary_choices)
    publicatiedatum_vanaf = models.DateField()
    inschrijven_vanaf = models.DateField()
    inschrijven_tot = models.DateField()
    onderdelen = models.ManyToManyField(Onderdeel, blank=True)
    prijs_leden = models.DecimalField(max_digits=5, decimal_places=2)
    prijs_niet_leden = models.DecimalField(max_digits=5, decimal_places=2)
    extra_onderdelen = models.ManyToManyField(ExtraOnderdeel, blank=True)

    def __str__(self):
        return '{} ({})'.format(self.name, self.datum.strftime('%d-%m-%Y'))

    class Meta:
        verbose_name_plural = "Evenementen"

If more info is needed I will provide of course. The model works fine when I use it in webviews and forms, so I don't understand what the problem could be. I have tested this in three different environments, all gave the same error.

  1. What is "limit_secretary_choices"?
  2. Does the error occur on the GET request (while opening Evenement object for change) or while saving the changes?
Back to Top