Skip to content

auto-author not working with anonymous users

To reproduce it :

DjangoLDP v0.5.38:

JSON sent :

@context	http://owl.openinitiative.com/oicontext.jsonld
@graph	[…]
0	{…}
@id	./
http://happy-dev.fr/owl/#objective	DjangoLDP 0.5.38 - Core 0.5.42
http://www.w3.org/2000/01/rdf-schema#label	DjangoLDP 0.5.38 - Core 0.5.42

Model :

class Post(models.Model):
    content = models.CharField(max_length=255)
    author = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True)

    class Meta:
        auto_author = 'author'
        permissions = (
            ('view_actiongroup', 'Read'),
            ('control_actiongroup', 'Control'),
        )
ValueError: Cannot assign "<django.contrib.auth.models.AnonymousUser object at 0x7fba3281ab00>": "ActionGroup.author" must be a "User" instance.
Edited by Sylvain Le Bon