Skip to content

Commit

Permalink
Major feature bump
Browse files Browse the repository at this point in the history
- Claims are now visible to all non-recepients
- Breaking: Suggested items are not visible to recipient
- Wishlists can be part of any number of groups
- Login/Signup/Account forms are now bootstrap-ifieid
- justfile for dev recipies
  • Loading branch information
parrotmac committed Dec 17, 2023
1 parent 60daa0f commit 7076d33
Show file tree
Hide file tree
Showing 29 changed files with 717 additions and 97 deletions.
16 changes: 16 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3.8'
services:
db:
image: postgres:16.1-alpine3.19
restart: always
environment:
POSTGRES_HOST_AUTH_METHOD: trust
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: postgres
# POSTGRES_DB: postgres
ports:
- "5900:5432"
redis:
image: redis:alpine3.17
ports:
- "6379:6379"
12 changes: 0 additions & 12 deletions docker-compose.yml

This file was deleted.

1 change: 1 addition & 0 deletions gary/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def get_envvar_list(envvar_name, default=[], separator=",", normalize=True):

ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_USER_DISPLAY = "gifter.utils.user_display"

AUTHENTICATION_BACKENDS = [
"django.contrib.auth.backends.ModelBackend",
Expand Down
29 changes: 29 additions & 0 deletions gifter/migrations/0006_wishlist_groups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 4.1.2 on 2023-12-17 02:04

from django.db import migrations, models


def forwards_func(apps, schema_editor):
Wishlist = apps.get_model("gifter", "Wishlist")
for wishlist in Wishlist.objects.all():
wishlist.groups.add(wishlist.group)
wishlist.save()


class Migration(migrations.Migration):
dependencies = [
("auth", "0012_alter_user_first_name_max_length"),
("gifter", "0005_alter_claim_options_alter_groupinvitation_options_and_more"),
]

operations = [
migrations.AddField(
model_name="wishlist",
name="groups",
field=models.ManyToManyField(related_name="wishlists", to="auth.group"),
),
migrations.RunPython(
code=forwards_func,
reverse_code=migrations.RunPython.noop,
),
]
16 changes: 16 additions & 0 deletions gifter/migrations/0007_remove_wishlist_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 4.1.2 on 2023-12-17 02:29

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("gifter", "0006_wishlist_groups"),
]

operations = [
migrations.RemoveField(
model_name="wishlist",
name="group",
),
]
4 changes: 2 additions & 2 deletions gifter/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ def __str__(self):
class Wishlist(CommonBaseClass):
title = models.CharField(max_length=120, blank=False, null=False)
owner = models.ForeignKey(User, on_delete=models.CASCADE)
group = models.ForeignKey(Group, on_delete=models.CASCADE)
groups = models.ManyToManyField(Group, related_name="wishlists")

def __str__(self):
return f"Wishlist for {self.owner} on {self.group.name}"
return f"Wishlist for {self.owner} (in {self.groups.count()} groups)"


class Item(CommonBaseClass):
Expand Down
2 changes: 2 additions & 0 deletions gifter/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ a:link, a:visited {
.profile {
display: flex;
align-items: center;
justify-content: center;
}

.profile-photo {
max-height: 40px;
max-width: 40px;
border-radius: 100px;
margin-right: 0.5em;
}

.socialaccount_providers {
Expand Down
32 changes: 30 additions & 2 deletions gifter/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
GroupDeleteView,
SendInviteFormView,
MyWishlistsListView,
ItemDeleteView,
ItemDeleteView, UpdateWishlistOptionsView, ClaimListView,
)

urlpatterns = [
Expand All @@ -41,6 +41,11 @@
path(
"groups/<str:group_pk>/wishlists/<str:pk>",
WishlistDetailView.as_view(),
name="wishlist_detail_with_group",
),
path(
"wishlists/<str:pk>",
WishlistDetailView.as_view(),
name="wishlist_detail",
),
path(
Expand All @@ -49,10 +54,15 @@
name="wishlist_update",
),
path(
"groups/<str:group_pk>/wishlists/<str:pk>/delete",
"wishlists/<str:pk>/delete",
WishlistDeleteView.as_view(),
name="wishlist_delete",
),
path(
"groups/<int:group_pk>/wishlists/<str:pk>/delete",
WishlistDeleteView.as_view(),
name="wishlist_delete_with_group",
),
path("wishlists", MyWishlistsListView.as_view(), name="my_wishlists"),
path(
"wishlists/<str:wishlist_pk>/items/create",
Expand All @@ -74,6 +84,16 @@
ClaimCreateView.as_view(),
name="claim_create",
),
path(
"wishlists/<str:wishlist_pk>/items/<str:item_pk>/claims",
ClaimListView.as_view(),
name="claim_list",
),
path(
"groups/<str:group_pk>/wishlists/<str:wishlist_pk>/items/<str:item_pk>/claims",
ClaimListView.as_view(),
name="claim_list_with_group",
),
path(
"wishlists/<str:wishlist_pk>/items/<str:item_pk>/claims/<str:pk>",
ClaimUpdateView.as_view(),
Expand All @@ -84,6 +104,14 @@
ClaimDeleteView.as_view(),
name="claim_delete",
),
path(
"wishlists/<str:pk>/add-to-group",
UpdateWishlistOptionsView.as_view(),
name="add_wishlist_to_group"),
path(
"wishlists/<str:pk>/remove-from-group",
UpdateWishlistOptionsView.as_view(),
name="remove_wishlist_from_group"),
path(
"invitations/incoming/<str:token>",
incoming_invitation,
Expand Down
7 changes: 7 additions & 0 deletions gifter/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@


def user_display(user):
if user.first_name or user.last_name:
return f"{user.first_name} {user.last_name}"
else:
return user.email
Loading

0 comments on commit 7076d33

Please sign in to comment.