Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ip address #1792

Merged
merged 9 commits into from
Dec 11, 2023
4 changes: 2 additions & 2 deletions api/dashboard/college/college_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def get(self, request, college_code=None):
paginated_queryset = CommonUtils.get_paginated_queryset(
colleges,
request,
search_fields=[""],
sort_fields=None,
search_fields=["org", ],
sort_fields={'org': 'org'},
)
serializer = CollegeListSerializer(
paginated_queryset.get("queryset"), many=True
Expand Down
2 changes: 1 addition & 1 deletion api/dashboard/college/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Meta:
model = College
fields = [
"id",
# "level",
"level",
"org",
"number_of_members",
"total_karma",
Expand Down
14 changes: 10 additions & 4 deletions api/url_shortener/url_shortener_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ def get(self, request, url_id):
devices = {}
sources = {}
countries = {}
dimensions = {}
ip_address = {}
city = {}
region = {}
time_based_data = {'all_time': []}

for query in queryset:
Expand All @@ -160,8 +162,10 @@ def get(self, request, url_id):
query.device_type, 0) + 1
sources[query.referrer] = sources.get(query.referrer, 0) + 1
countries[query.country] = countries.get(query.country, 0) + 1
dimensions[query.device_type] = dimensions.get(
query.device_type, 0) + 1
ip_address[query.ip_address] = ip_address.get(
query.ip_address, 0) + 1
city[query.city] = city.get(query.city, 0) + 1
region[query.region] = region.get(query.region, 0) + 1

# Create a list of time-based data
time_based_data['all_time'].append([
Expand All @@ -177,8 +181,10 @@ def get(self, request, url_id):
'platforms': platforms,
'devices': devices,
'sources': sources,
'ip_address': ip_address,
'city': city,
'region': region,
'countries': countries,
'dimensions': dimensions,
'time_based_data': time_based_data,
'long_url': url_shortener.long_url,
'short_url': url_shortener.short_url,
Expand Down
Loading