Skip to content

Commit

Permalink
improved view handling for representation systems
Browse files Browse the repository at this point in the history
- added view by code
  • Loading branch information
stuchalk committed Nov 29, 2023
1 parent 14eeb93 commit cc05dc9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion repsystems/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@ def index(request):

def view(request, rsid):
""" get data about a representation system and the unit representations in the db """
if type(rsid) is int:
rsys = Repsystems.objects.get(id=rsid)
elif type(rsid) is str:
rsys = Repsystems.objects.get(abbrev=rsid)
else:
rsys = None
if rsys is None:
return render(request, '/')
port = request.META['SERVER_PORT']
rsys = Repsystems.objects.get(id=rsid)
reps = rsys.representations_set.all()
return render(request, "../templates/repsystems/view.html", {'rsys': rsys, 'reps': reps, 'port': port})

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pyproject_hooks>=1.0
PySocks==1.7.1
pytz>=2022.7.1
PyYAML==6.0
qwikidata>=0.4
qwikidata>=0.4.2
rdflib>=6.2
reqs==0.0.2
requests>=2.28
Expand Down

0 comments on commit cc05dc9

Please sign in to comment.