Skip to content
Snippets Groups Projects
Commit bcecbe61 authored by Rafael László's avatar Rafael László :speech_balloon:
Browse files

patch updated_by

parent 4e4df036
No related branches found
No related tags found
1 merge request!2Dev
......@@ -17,7 +17,8 @@ class Article(models.Model):
updated_by = models.ForeignKey(
Profile,
related_name="updater",
on_delete=models.DO_NOTHING
on_delete=models.DO_NOTHING,
default=CurrentUserMiddleware.get_current_user_profile
)
def __str__(self):
......
......@@ -4,13 +4,12 @@ from common.serializers import CurrentUserProfileDefault
class ArticleSerializer(serializers.ModelSerializer):
updated_by = serializers.HiddenField(default=CurrentUserProfileDefault())
last_update_by = serializers.SerializerMethodField()
author = serializers.SerializerMethodField()
class Meta:
model = Article
read_only_fields = ('author', 'created_at', 'updated_at', 'updated_by')
read_only_fields = ('author', 'created_at', 'updated_at')
fields = '__all__'
def get_last_update_by(self, obj):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment