Add unique constraint to followers relationship. #47
This commit is contained in:
parent
38ec3c554b
commit
e0266cb754
2 changed files with 22 additions and 0 deletions
|
@ -73,6 +73,11 @@ class UserRelationship(FedireadsModel):
|
|||
status = models.CharField(max_length=100, default='follows', null=True)
|
||||
relationship_id = models.CharField(max_length=100)
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=['user_subject', 'user_object'], name='followers_unique')
|
||||
]
|
||||
|
||||
@property
|
||||
def absolute_id(self):
|
||||
''' use shelf identifier as absolute id '''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue