Commit 21c0b8ab authored by Alice's avatar Alice

Update the like model.

parent a7d58b81
Pipeline #6439 passed with stage
in 27 seconds
from django.db import models
from djangoldp.models import Model
from djangoldp.fields import IdURLField
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.conf import settings
from django.utils import timezone
from django.contrib.auth import get_user_model
class Like(models.Model):
sender = IdURLField(max_length=300)
receiver_content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
receiver_object_id = models.PositiveIntegerField()
receiver = GenericForeignKey(
class Like(Model):
sender = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, related_name='likes')
timestamp = models.DateTimeField(
# Please refer to Django documentation
class Meta:
serializer_fields = ['sender']
serializer_fields = ["@id", 'sender', "resource"]
container_path = 'likes/'
rdf_type = 'coopstarter:like'
nested_fields = ["sender"]
anonymous_perms = ['view']
authenticated_perms = ['inherit', 'add']
owner_perms = ['inherit', 'change', 'control', 'delete']
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment