Skip to content

Commit

Permalink
finished past admin
Browse files Browse the repository at this point in the history
  • Loading branch information
xjlin0 committed Jun 14, 2021
1 parent 2af76bc commit 0d0c945
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ https://dbdiagram.io/d/5d5ff66eced98361d6dddc48

## Todo:
- [x] make auth group not organization specific, and counselling note check on organization
- [ ] Past can replace Note, Attendee.progressions and calls/requests, so that any name lists such as membership/status can be easily queried.
- [ ] Past can replace Note, Attendee.progressions and calls/requests, so that any name lists such as status can be easily queried. (membership remains as attendance)
- [ ] attendee detail page
- [x] server side process of Attendees list & search page
- [x] AttendingMeet form of Attendee update page
Expand All @@ -101,7 +101,7 @@ https://dbdiagram.io/d/5d5ff66eced98361d6dddc48
- [x] Dynamic contacts of Attendee update page
- [x] Permission controlled blocks in single attendee update page, i.e. different blocks/user-settings for different groups
- [x] Generic models such as Note, Place, Past need to have organization column instead of infos
- [ ] Add note
- [x] Add Past as Note
- [ ] Create new instance of Attendee & attending update page with params with meet
- [x] Modify Attendee save method to combine/convert names by OpenCC to support searches in different text encoding, and retire db level full_name.
- [x] implement secret/private relation/past general
Expand Down
24 changes: 20 additions & 4 deletions attendees/persons/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,29 @@ class PastAdmin(admin.ModelAdmin):

def get_queryset(self, request):
qs = super().get_queryset(request)
counseling_category = Category.objects.get(type='note', display_name=Past.COUNSELING)

if request.resolver_match.func.__name__ == 'changelist_view':
messages.warning(request, 'Not all, but only those records accessible to you will be listed here.')
requester_permission = {'infos__show_secret__' + request.user.attendee_uuid_str(): True}
return qs.filter(
Q(organization=request.user.organization),
( Q(**requester_permission) | Q(infos__show_secret={}) | Q(infos__show_secret__isnull=True) ),
)

if request.user.is_counselor():
counselors_permission = {'infos__show_secret__' + Past.ALL_COUNSELORS: True}
return qs.filter(
Q(organization=request.user.organization),
(~Q(category=counseling_category)
|
(Q(category=counseling_category) and (Q(**requester_permission)
|
Q(**counselors_permission))
)),
)

else:
return qs.filter(
Q(organization=request.user.organization),
( Q(**requester_permission) | Q(infos__show_secret={}) | Q(infos__show_secret__isnull=True) ),
).exclude(category=counseling_category)


class FamilyAdmin(admin.ModelAdmin):
Expand Down
3 changes: 2 additions & 1 deletion attendees/scripts/load_access_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ def update_attendee_membership(pdt, attendee, data_assembly, member_meet, member
'attending': data_attending,
'meet': member_meet,
'character': member_character,
'category': 'tertiary',
'category': 'active',
'start': Utility.parsedate_or_now(attendee.progressions.get('member_since')),
'finish': member_meet.finish,
}
Expand All @@ -810,6 +810,7 @@ def update_attendee_membership(pdt, attendee, data_assembly, member_meet, member
'attending': data_attending,
'character': member_character,
'team': None,
'category': 'active', # membership can be inactive temporarily
'start': member_attending_meet_default['start'],
'finish': member_gathering.finish,
'infos': {
Expand Down

0 comments on commit 0d0c945

Please sign in to comment.