Simplify /door/ route card listing
This commit is contained in:
parent
668a0dd349
commit
2fd1d52a71
|
@ -288,15 +288,13 @@ class DoorViewSet(viewsets.ViewSet, List):
|
||||||
cards = models.Card.objects.filter(active_status='card_active')
|
cards = models.Card.objects.filter(active_status='card_active')
|
||||||
active_member_cards = {}
|
active_member_cards = {}
|
||||||
|
|
||||||
# format cards to match Emrah's conversion script, fix later
|
|
||||||
for card in cards:
|
for card in cards:
|
||||||
member = get_object_or_404(models.Member, id=card.member_id)
|
member = get_object_or_404(models.Member, id=card.member_id)
|
||||||
if member.paused_date: continue
|
if member.paused_date: continue
|
||||||
|
|
||||||
active_member_cards[card.card_number] = dict(
|
active_member_cards[card.card_number] = '{} ({})'.format(
|
||||||
name=member.first_name + ' ' + member.last_name[0],
|
member.first_name + ' ' + member.last_name[0],
|
||||||
id=member.id,
|
member.id,
|
||||||
enabled=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response(active_member_cards)
|
return Response(active_member_cards)
|
||||||
|
|
|
@ -855,9 +855,6 @@ Door
|
||||||
|
|
||||||
List all active cards of unpaused members.
|
List all active cards of unpaused members.
|
||||||
|
|
||||||
The json dict format is to match the current front door controller's script
|
|
||||||
and will likely be changed in the future.
|
|
||||||
|
|
||||||
No authentication required.
|
No authentication required.
|
||||||
|
|
||||||
**Example response**
|
**Example response**
|
||||||
|
@ -867,22 +864,12 @@ Door
|
||||||
.. sourcecode:: json
|
.. sourcecode:: json
|
||||||
|
|
||||||
{
|
{
|
||||||
"0000001234": {
|
"0000001234": "Tanner C (1685)",
|
||||||
"name": "Tanner C",
|
"000000ABCD": "Tanner C (1685)",
|
||||||
"id": 1685,
|
|
||||||
"enabled": true
|
|
||||||
},
|
|
||||||
"000000ABCD": {
|
|
||||||
"name": "Tanner C",
|
|
||||||
"id": 1685,
|
|
||||||
"enabled": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:json key: The dict keys are the card numbers.
|
:json key: The dict keys are the card numbers.
|
||||||
:json int id: Member's ID.
|
:json value: Member's name and ID.
|
||||||
:json name: Member's name.
|
|
||||||
:json boolean enabled: Always true.
|
|
||||||
|
|
||||||
.. http:post:: /door/(card_number)/seen/
|
.. http:post:: /door/(card_number)/seen/
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ Install dependencies:
|
||||||
|
|
||||||
.. sourcecode:: bash
|
.. sourcecode:: bash
|
||||||
|
|
||||||
# Misc:
|
|
||||||
$ sudo apt update
|
$ sudo apt update
|
||||||
$ sudo apt install memcached
|
$ sudo apt install memcached
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user