reversed all the queies in descending order for admin dashboard

This commit is contained in:
rizwanisready
2024-03-19 11:57:31 +05:30
parent accee7668c
commit 5651bae4fb
15 changed files with 19 additions and 4 deletions

View File

@@ -85,7 +85,7 @@ def get_location_info(latitude, longitude):
for component in location.get("address_components", []):
types = component.get("types", [])
print("types: ", types)
# print("types: ", types)
if "locality" in types:
city = component.get("long_name")
elif "administrative_area_level_1" in types:

View File

@@ -112,7 +112,9 @@ class ReferralCodeView(LoginRequiredMixin, generic.ListView):
context_object_name = "code"
def get_queryset(self):
return super().get_queryset().filter(active=True, deleted=False)
queryset = super().get_queryset().filter(active=True, deleted=False).order_by("-id")
print(f"is {queryset}")
return queryset
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)

View File

@@ -108,7 +108,8 @@ class SubscriptionView(LoginRequiredMixin, generic.ListView):
context_object_name = "subscription_obj"
def get_queryset(self):
return super().get_queryset().filter(deleted=False, active=True)
queryset = super().get_queryset().filter(deleted=False, active=True)
return queryset.order_by("-created_on")
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)

View File

@@ -156,6 +156,7 @@
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"order": [[ 0, "desc" ]],
"stripeClasses": [],
"lengthMenu": [5, 10, 20, 50],
"pageLength": 10

View File

@@ -135,6 +135,7 @@
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"order": [[ 0, "desc" ]],
"stripeClasses": [],
"lengthMenu": [5, 10, 20, 50],
"pageLength": 10

View File

@@ -118,6 +118,7 @@
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"order": [[ 0, "desc" ]],
"stripeClasses": [],
"lengthMenu": [5, 10, 20, 50],
"pageLength": 10

View File

@@ -119,6 +119,7 @@
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"order": [[ 0, "desc" ]],
"oLanguage": {
"oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
"sInfo": "Showing page PAGE of _PAGES_",

View File

@@ -25,7 +25,7 @@
<!-- <a class="btn btn-primary mb-2" href="{% url 'manage_referrals:track_list' %}">Referral Tracking</a> -->
<a class="btn btn-primary mb-2" href="{% url 'manage_referrals:coin_list' %}">Good Time Coins</a>
<a class="btn btn-primary mb-2" href="{% url 'manage_referrals:code_list' %}">Referral Codes</a>
</div>
</div>
@@ -124,6 +124,7 @@
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"order": [[0, "desc"]],
"oLanguage": {
"oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
"sInfo": "Showing page PAGE of _PAGES_",

View File

@@ -128,6 +128,7 @@
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"order": [[ 0, "desc" ]],
"stripeClasses": [],
"lengthMenu": [5, 10, 20, 50],
"pageLength": 10

View File

@@ -95,6 +95,7 @@
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"order": [[ 0, "desc" ]],
"stripeClasses": [],
"lengthMenu": [5, 10, 20, 50],
"pageLength": 10

View File

@@ -143,6 +143,7 @@
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"order": [[ 0, "desc" ]],
"stripeClasses": [],
"lengthMenu": [5, 10, 20, 50],
"pageLength": 10

View File

@@ -116,6 +116,7 @@
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"order": [[ 0, "desc" ]],
"stripeClasses": [],
"lengthMenu": [5, 10, 20, 50],
"pageLength": 10

View File

@@ -128,6 +128,7 @@
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"order": [[ 0, "desc" ]],
"stripeClasses": [],
"lengthMenu": [5, 10, 20, 50],
"pageLength": 10

View File

@@ -110,6 +110,7 @@
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"order": [[ 0, "desc" ]],
"stripeClasses": [],
"lengthMenu": [5, 10, 20, 50],
"pageLength": 10

View File

@@ -98,6 +98,7 @@
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"order": [[ 0, "desc" ]],
"stripeClasses": [],
"lengthMenu": [5, 10, 20, 50],
"pageLength": 10