mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-11 10:46:37 +00:00
run black for clean code
Godammit Hugh remember to do this before pushing new code.
This commit is contained in:
parent
b3dc81dea0
commit
f8e0de1ea9
4 changed files with 816 additions and 69 deletions
File diff suppressed because one or more lines are too long
|
@ -37,6 +37,7 @@ class GroupMember(models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
"""Users can only have one membership per group"""
|
"""Users can only have one membership per group"""
|
||||||
|
|
||||||
constraints = [
|
constraints = [
|
||||||
models.UniqueConstraint(fields=["group", "user"], name="unique_membership")
|
models.UniqueConstraint(fields=["group", "user"], name="unique_membership")
|
||||||
]
|
]
|
||||||
|
@ -85,6 +86,7 @@ class GroupMemberInvitation(models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
"""Users can only have one outstanding invitation per group"""
|
"""Users can only have one outstanding invitation per group"""
|
||||||
|
|
||||||
constraints = [
|
constraints = [
|
||||||
models.UniqueConstraint(fields=["group", "user"], name="unique_invitation")
|
models.UniqueConstraint(fields=["group", "user"], name="unique_invitation")
|
||||||
]
|
]
|
||||||
|
|
|
@ -38,10 +38,7 @@ class GroupViews(TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
self.testgroup = models.Group.objects.create(
|
self.testgroup = models.Group.objects.create(
|
||||||
id=999,
|
id=999, name="Test Group", user=self.local_user, privacy="public"
|
||||||
name="Test Group",
|
|
||||||
user=self.local_user,
|
|
||||||
privacy="public"
|
|
||||||
)
|
)
|
||||||
self.membership = models.GroupMember.objects.create(
|
self.membership = models.GroupMember.objects.create(
|
||||||
group=self.testgroup, user=self.local_user
|
group=self.testgroup, user=self.local_user
|
||||||
|
@ -83,11 +80,11 @@ class GroupViews(TestCase):
|
||||||
"""edit a "group" database entry"""
|
"""edit a "group" database entry"""
|
||||||
view = views.Group.as_view()
|
view = views.Group.as_view()
|
||||||
view.post(
|
view.post(
|
||||||
group_id=999,
|
group_id=999,
|
||||||
name="Test Group",
|
name="Test Group",
|
||||||
user=self.local_user,
|
user=self.local_user,
|
||||||
privacy="public",
|
privacy="public",
|
||||||
description="Test description",
|
description="Test description",
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual("Test description", self.testgroup.description)
|
self.assertEqual("Test description", self.testgroup.description)
|
|
@ -146,7 +146,8 @@ class Groups(View):
|
||||||
user = get_user_from_username(request.user, username)
|
user = get_user_from_username(request.user, username)
|
||||||
|
|
||||||
paginated = Paginator(
|
paginated = Paginator(
|
||||||
models.Group.memberships.filter(user=user).order_by("-created_date"), PAGE_LENGTH
|
models.Group.memberships.filter(user=user).order_by("-created_date"),
|
||||||
|
PAGE_LENGTH,
|
||||||
)
|
)
|
||||||
data = {
|
data = {
|
||||||
"user": user,
|
"user": user,
|
||||||
|
|
Loading…
Reference in a new issue