Skip to content

Commit

Permalink
Merge pull request #134 from Macktireh/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Macktireh authored Aug 10, 2024
2 parents 24c3c87 + 4264da4 commit c76ca91
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
4 changes: 2 additions & 2 deletions apps/follow/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def connect_people(self, user):
f.following.public_id for f in following
]

users = User.objects.all()
users = User.objects.prefetch_related("profile").all()
people = []

for u in users:
Expand All @@ -49,4 +49,4 @@ def connect_people(self, user):
people.append(u)

qs = list_to_queryset(model=User, data=people)
return qs
return qs.order_by("profile__sort_id")
4 changes: 2 additions & 2 deletions apps/profiles/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
@admin.register(Profile)
class ProfileAdmin(admin.ModelAdmin):

list_display = ('full_name', 'pseudo', 'bio', 'birth_date',)
list_display = ('full_name', 'pseudo', 'bio', 'created', 'updated',)
fieldsets = (
(None, {'fields': ('user',)}),
(_('Personal info'), {'fields': ('pseudo', 'bio', 'birth_date', 'profile_picture', 'cover_picture',)}),
# (_('Following'), {'fields': ('following',)}),
(_('Sorting'), {'fields': ('sort_id',)}),
)
search_fields = ('full_name', 'pseudo',)

Expand Down
18 changes: 18 additions & 0 deletions apps/profiles/migrations/0002_profile_sort_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.7 on 2024-08-10 16:51

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('profiles', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='profile',
name='sort_id',
field=models.IntegerField(default=9999, null=True),
),
]
1 change: 1 addition & 0 deletions apps/profiles/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Profile(models.Model):
)
isUploadProfilePic = models.BooleanField(default=False)
isUploadCoverPic = models.BooleanField(default=False)
sort_id = models.IntegerField(default=9999, null=True)
# following = models.ManyToManyField(User, blank=True, related_name='following')
# follower = models.ManyToManyField(User, blank=True, related_name='follower')
updated = models.DateTimeField(auto_now=True)
Expand Down

0 comments on commit c76ca91

Please sign in to comment.