Skip to content

Commit

Permalink
Set serializer attributes in __init__ (#18)
Browse files Browse the repository at this point in the history
Hopefully closes #16 for good
  • Loading branch information
rixx authored May 21, 2024
1 parent c472a97 commit 7ef7500
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions urlman/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ class Field:
class UrlManField(Field):
"""Serializer class for Django Restframework."""

read_only = True
write_only = False
label = None
source = "*"

def __init__(self, urls, attribute="urls", full=True, **kwargs):
kwargs.setdefault("read_only", True)
kwargs.setdefault("write_only", False)
kwargs.setdefault("label", None)
kwargs.setdefault("source", "*")
super().__init__(**kwargs)
self.urls = urls
self.url_attribute = attribute
Expand Down

0 comments on commit 7ef7500

Please sign in to comment.