Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Download files in django from database and also view pdf file in that
Well, I am trying to make a simple app in django in which I upload files from admin panel. The user is greeted with a simple search page in which he enters an id which thus needs to produce the related file. The file is to be in pdf format. So if there is a way I could view the pdf file in the browser and a download button which downloads the file. The code is hosted on Github, the link is https://github.com/tahseen09/delhipatho -
Django DB Model, Create two identical tables, one inheriting from the other
I have a requirement where I would like to have identical tables in Django. For example MyTableCurrent and MyTableArchive. The tables should be identical except of the class/table name and the foreign key references. Is there a way to basically maintain the schema on MyTableCurrent, then under MyTableArchive, I inherit from the base class of MyTableCurrent but override just the foreign key fields to match the corresponding Archive table? -
Send alert message(data) from one login user session to another
I have a use case where a user (manager) creates a task (1st view) and another logged in user (employee) can view the task created (2nd view). If the employee rejects the task clicking reject button, an alert should notify the manager. How do I achieve this functionality? Thanks for any guidance. -
Django: Retrieve a model Queryset that created today but has no entries before.
Lets take a situation, class A(models.Model): customer = models.FK(User) ... I need to fetch all the rows created today but only the rows that is created for the first time against each customer. Suppose a customer made an entry yesterday and today, we do not want to include it. But if the customer is making an entry for the first time today in the table it has to be included. This can be achieved using two different querying steps , one to fetch all entries today then check if the customer is made that entry for the first time in this table using next step of query. What I am searching for is a better optimized way to achieve this. Is there a better solution, a better way to use Django ORM? -
Django "redirect" by adding a query parameter to URL
I would like to achieve the following behavior: The user types www.example.com/list in the browser and hits Enter In their browser, the URL is automatically changed to www.example.com/list?page=1 The URL with page parameter is evaluated by Django How to achieve this using Django generic ListView with pagination? class RecordList(ListView): model = Record paginate_by = 25 -
static files not found in django 1.11
I am getting "Not Found" when accessing any page on localhost. I have read all related posts but still cannot understand why. I have included 'django.contrib.staticfiles' in INSTALLED_APPS. I have DEBUG = TRUE in my settings.py my project layout and code is as the following. Thank you in advance. repo_root ├── manage.py │ ├── project_root │ │ │ ├── accounts │ │ ├── migrations │ │ ├── __init__.py │ │ ├── admin.py │ │ ├── apps.py │ │ ├── models.py │ │ ├── tests.py │ │ ├── views.py │ │ └── urls.py │ │ │ ├── templates │ │ └── index.html │ │ │ └── static │ └── assets │ ├── bootstrap │ ├── css │ ├── fonts │ ├── img │ └── js │ ├── config_root │ ├── __init__.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py │ settings.py STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join( BASE_DIR, 'project_root/static/assets') ] STATIC_ROOT = os.path.join( BASE_DIR, 'project_root/staticfiles') index.html <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no"> <title>index</title> <meta name="description" content="sample_content"> <link rel="stylesheet" href="'static/assets/bootstrap/css/bootstrap.min.css'"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,400i,700,700i,600,600i"> <link rel="stylesheet" href="'static/assets/fonts/simple-line-icons.min.css'"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css"> <link rel="stylesheet" href="'static/assets/css/smoothproducts.css'"> </head> urls.py url(r'^index/$', IndexView.as_view()) views.py class IndexView(TemplateView): template_name = "index.html" -
Django ORM. Retrieve 10 items for each category
I have 2 models in My Django REST. class Category(models.Model): name = models.CharField() class Item(models.Model): name = models.CharField() category = models.ForeignKey(Category) I need build queryset where i get 10 items for each category. I dont know i need Filter Category or Item, but maybe somebody can help me. I think i need something like this: Item.objects.filter.. if item with same category not > 10. I will be pleasure if somebody show me some way or decision. -
Django rest api redirect to S3 download link returns mime type warning in chrome console
I'm using Django Rest Framework to build an API and I'm trying to redirect my endpoint to download files from AWS S3. It's working but in Chrome I'm getting the following warning: Resource interpreted as Document but transferred with MIME type application/force-download This is my get method from my view: def get(self, request, pk, format=None): file_item = self.get_object(pk) serializer = FileSerializer(file_item) response = redirect(serializer.data['file_url'], content_type ='application/force-download') return response As you can see, I have passed content type, why does it Chrome still throw a warning? I need to be able to download files in various formats e.g. pdf, jpg etc. -
Can't loas static files Django 1.9
Template cant find static files and load it on page. This is my settings: import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) TEMPLATE_DIR = os.path.join(BASE_DIR,'cargo/templates') # STATIC_DIR = os.path.join(BASE_DIR,'cargo/static') DEBUG = True ALLOWED_HOSTS = [] TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [TEMPLATE_DIR], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'mysite.wsgi.application' # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.9/howto/static-files/ STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static"), ] STATIC_ROOT = 'os.path.join(os.path.expanduser("~"), "domains/h2h.su/static/")' This my path to files cargo/static/cargo/images and templates at the same path in cargo app cargo/templates/cargo/index.html Can someone help me? -
python django sort with lambda with if statement
I have date and some dollar gross model: class FirstDate(models.Model): gross = models.DecimalField(max_digits=12, decimal_places=2, default=0) updated = models.DateTimeField(auto_now=True) class SecondDate(models.Model): gross = models.DecimalField(max_digits=12, decimal_places=2, default=0) updated = models.DateTimeField(auto_now=True) And want to sort it by gross, and if gross is the same, then sort it with updated field For example, qs1 = SoloDate.objects.all()[:2] qs2 = GroupDate.objects.all()[:2] result_list = sorted( chain(qs1, qs2), key=lambda x: x.gross # and if gross is the same, for the gross same objects, x.updated and then update was also the same, x.pk, ) I mean, let me say that there is two objects individually from qs1 and qs2. # objects from qs1 qs1_obj1 = { 'pk': 1, 'gross': 5, 'updated': 2018-11-24 10:53:23.360707+00:00 } qs1_obj2 = { 'pk': 2, 'gross': 5, 'updated': 2018-11-25 10:53:23.360707+00:00 } # objects from qs2 qs2_obj1 = { 'pk': 3, 'gross': 5, 'updated': 2018-11-24 10:53:23.360707+00:00 } qs2_obj2 = { 'pk': 4, 'gross': 1, 'updated': 2018-11-23 10:53:23.360707+00:00 } It's result_list order will be qs1_obj1, qs2_obj1, qs1_obj2, qs_2_obj_2. Reasons is it: qs1_obj1: 1.by gross is big, 2.by updated, 3.by pk, qs2_obj1: 1.by gross, 2.by updated, 3. but pk was not good, qs1_obj2: 1.by gross, 2.but by dpdated was late, qs2_obj2: 1.gross was small. Maybe it is not … -
Invalid HTTP_HOST header - Django
I started receiving a lot invalid HTTP_HOST on my django server, out of nowhere.... The allowed_hosts are correct, I think someone is trying to break in... here are the fails: Invalid HTTP_HOST header: 'www.google.com'. You may need to add 'www.google.com' to ALLOWED_HOSTS. Invalid HTTP_HOST header: '127.0.0.1:30303'. You may need to add '127.0.0.1' to ALLOWED_HOSTS. Invalid HTTP_HOST header: '/home/site/myapp.sock:'. The domain name provided is not valid according to RFC 1034/1035. Invalid HTTP_HOST header: 'xxxx.members.linode.com'. You may need to add 'xxxx.members.linode.com' to ALLOWED_HOSTS. Any idea why this starts happening? -
Django-filter for nullable Boolean Field
I would lite to use django-filter for BooleanField(blank=True, null=True). When I use it out of the box, the form generates three options: Unknown (no filtering), Yes (True) and No (False). However, I need a fourth option for None so that the filter specifically selects those records with value None. My model (relevant part): class Record(Model): accepted = BooleanField(blank=True, null=True, verbose_name=_("Accepted?")) My filter (relevant part): class RecordFilter(FilterSet): class Meta: model = Record fields = OrderedDict(( ("accepted", ["exact"]), )) My view: class RecordList(LoginRequiredMixin, FilterView): model = Record paginate_by = 25 template_name = "record/record_list.html" filterset_class = RecordFilter My template (relevant part): <form method="get" role="form" class="form"> {{ filter.form.as_p }} <button>{% trans "Filter" %}</button> </form> How can I achieve the desired behavior? -
Making a multi-selection HTML table in django
def index(request): pull_requestsList = Pull_Requests.objects.all() paginator = Paginator(pull_requestsList, 25) page=request.GET.get('page') try: pullrequests=paginator.page(page) #pullRequest_dict = {'pull_requests': pullrequest} except PageNotAnInteger: pullrequests=paginator.page(1) except EmptyPage: pullrequests=paginator.page(paginator.num_pages) return render(request, 'index.html', {'pullrequests': pullrequests}) {% load staticfiles %} <link rel="stylesheet" type="text/css" href="{% static 'css/style.css'%}"> {% block body %} <div class="container" align="center" xmlns="http://www.w3.org/1999/html"> {% block table %} <p><br><br><br><br></p> <table class="table table-bordered" border="1"> <tr> <th>Project</th> <th>Pull Request ID </th> <th>Nb comments </th> <th> LC added </th> <th> LC deleted </th> <th> Nb commits </th> <th> Nb changed fies </th> <th> Closed status </th> <th> Reputation </th> <th> Label </th> </tr> {% for field in pullrequests %} <tr> <td>{{ field.pr_project }}</td> <td>{{ field.pr_id }} </td> <td>{{ field.nd_comments }} </td> <td>{{ field.nb_added_lines_code }}</td> <td>{{ field.nb_deleted_lines_code }}</td> <td>{{ field.nb_commits }}</td> <td>{{ field.nb_changed_fies }}</td> <td>{{ field.Closed_status }}</td> <td>{{ field.reputation }}</td> <td>{{ field.Label }}</td> </tr> {% endfor %} </table> {% endblock table %} </div> {% endblock %} <div class="pagination" align="center"> <span class="step-links"> {% if pullrequests.has_previous %} <a href="?page={{ pullrequests.previous_page_number }}">Previous</a> {% endif %} <span class="current"> Page {{ pullrequests.number }} of {{ pullrequests.paginator.num_pages }}. </span> {% if pullrequests.has_next %} <a href="?page={{ pullrequests.next_page_number }}">Next</a> {% endif %} </span> </div> I would like to allow users to be able to select multiple rows in my HTML table … -
Unable import django models after compiling with Cython
have compiled django app with following command python3 compile.py build_ext --inplace, which generated models.cpython-35m-x86_64-linux-gnu.so file within app. Later on running the django server, getting following error File "/home/env3/lib/python3.5/site-packages/django/db/models/base.py", line 113, in new "INSTALLED_APPS." % (module, name) RuntimeError: Model class models.Country doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. Here Country is one of the model class within models.py file -
Display intro video first visit only Django
I have a Django app that needs to display a video that gives an into to the website. I only want it to do this on the initial visit as opposed to every time the user refreshes. I feel like sessions would have something to do with this but I’m not sure. Thanks! -
Django Rest Framework - Updating related model using ModelSerializer and ModelViewSet
BACKGROUND I have two serializers: PostSerializer and PostImageSerializer which both inherit DRF ModelSerializer. The PostImage model is linked with Post by related_name='photos'. Since I want the serializer to perform update, PostSerializer overrides update() method from ModelSerializer as stated in official DRF doc. class PostSerializer(serializers.ModelSerializer): photos = PostImageSerializer(many=True) class Meta: model = Post fields = ('title', 'content') def update(self, instance, validated_data): photos_data = validated_data.pop('photos') for photo in photos_data: PostImage.objects.create(post=instance, image=photo) return super(PostSerializer, self).update(instance, validated_data) class PostImageSerializer(serializer.ModelSerializer): class Meta: model = PostImage fields = ('image', 'post') I have also defined a ViewSet which inherits ModelViewSet. class PostViewSet(viewsets.ModelViewSet): queryset = Post.objects.all() serializer_class = PostSerializer Finally the PostViewSet is registered to DefaultRouter. (Omitted code) Goal The goals are simple. Send PUT request via PostMan with url like 'PUT http://localhost:8000/api/posts/1/' Since Image files should be included, request would be done by form-data like below. Problem I'm getting 400 Response with error message as following. { "photos": [ "This field is required." ], "title": [ "This field is required." ], "content": [ "This field is required." ] } (Should you plz note that the error messages might not exactly fit with DRF error messages since they are translated.) It is obvious that none of my PUT … -
Password protect individual urls with url specific passwords in Django?
So I have a bunch of pages with urls that look like: /article/detail/1 /article/detail/2 /article/detail/3 ... I would like to password protect some of these urls and the ones that are protected will have their own passwords so it may look like: -------URL---------Password-------- /article/detail/1 | password1 /article/detail/2 | s3cret /article/detail/3 | This really does not need to be all that secure because the information stored here isn't all that important. I am storing the 'passwords' in plain text in my database. And ideally, all I want is that whenever the user tries to access one of these URLs, if it has no password, user goes directly to the page, if it does have a password, they are taken to some intermediate page where they can put in this password. Whats the simplest way of achieving this? I can post exact code here if required but essentially all of these pages have a views.py that looks like: class ArticleDetailView(LoginRequiredMixin, ListView): template_name = 'cb_detail.html' login_url = 'login' def get_queryset(self): return Data.getAllPosts() def get_context_data(self, **kwargs): # populate context return context So there is no model being used here. The LoginReqiredMixin is used to ensure that the user is actually logged in but I … -
Is there a way to move a my ِDJANGO program to other computer without the need of re installing all the required module?
Is there a way to move a my ِdjango-python program to other computer without the need of re installing all the required module? -
django csv import automatically
i'm Marcello from italy, i'm new in python and django. I ask a question to get info for my project in django. I've created a project that have two tables, my problem is that how get data automatically from csv, i will create an ftp server that stored csv.txt and update the tables (for example every day). Now i update with Django import / export manually. I would like that django read csv files and update db then delete. Thank you very much for all your support!!! my models.py: from django.db import models from django.urls import reverse class AnagraficaCliente(models.Model): codice_cliente = models.CharField(max_length=20, primary_key=True, null=False, unique=True) ragione_sociale = models.CharField(max_length=40) ragione_sociale_dest = models.CharField(max_length=40) nome = models.CharField(max_length=20, blank=True) cognome = models.CharField(max_length=20, blank=True) ragione_sociale = models.CharField(max_length=20) indirizzo = models.TextField(blank=True) cap = models.CharField(max_length=5, blank=True) piva = models.CharField(max_length=11, blank=True) vatnumber = models.CharField(max_length=13, blank=True) ragione_sociale_dest = models.CharField(max_length=40) indirizzo_dest = models.TextField(null=True) def __str__(self): #return self.ragione_sociale + " " + self.codice_cliente return self.ragione_sociale_dest + " " + self.indirizzo_dest class Meta: verbose_name = "AnagraficaCliente" verbose_name_plural = "AnagraficaClienti" class Tracking(models.Model): track = models.CharField(max_length=10, null=False, unique=True, primary_key=True) passaggio1 = models.CharField(max_length=50, blank=True) passaggio2 = models.CharField(max_length=50, blank=True) passaggio3 = models.CharField(max_length=50, blank=True) passaggio4 = models.CharField(max_length=50, blank=True) passaggio5 = models.CharField(max_length=50, blank=True) consegna = ( ('C', 'Consegnato'), … -
Regroup in django returning only one grouper - not iterating on regrouped list
I have a simple ListView of a Model with a DateTimeField, the Model is ordered by this field. In the template, I have the following code: {% regroup teamsession_list by tdate|date:"W" as weekly_list %} {% for training_week in weekly_list %} <div class="container"> {{training_week}}</div>{% endfor %} I wrote this to test the returned result. I have four weeks of data, but only one grouper returned in the template like so GroupedResult(grouper='48', list=[<TeamSession: xesr: performed on 2018-11-27 00:00:00+00:00>, <TeamSession: test4: performed on 2018-11-26 00:00:00+00:00>, <TeamSession: test5: performed on 2018-11-26 00:00:00+00:00>, <TeamSession: test: performed on 2018-11-26 00:00:00+00:00>]) Anyone with an idea why the other four week is not in the result? The view looks like this: class TeamWeeklyView(ListView): model=models.TeamSession template_name = 'teams/weekly.html' I know there is a weekly archive view, but its not suitable for my purposes. -
How to decode URL with Persian slug in Django 2.0?
I have an archive view that using Persian slug like: چینیها-خورشید-مصنوعی-هم-ساختند with this url pattern: urlpatterns = [ ... path('archive/<str:slug>/', views.ArchiveDetailView.as_view(), ... ] models.py: class Archive(models.Model): ... slug = models.SlugField(_('Slug'), max_length=128, unique=True, allow_unicode=True) ... views.py: class ArchiveDetailView(DetailView): model = Archive def get_object(self, queryset=None): slug = self.kwargs.get(self.slug_url_kwarg) return get_object_or_404(self.model, slug=slug) This work fine in local with Django built-in webserver. But when I deploy site on my host (cPanel) return 404 error (only for Persian slug). How can I fix it? -
Django radio form showing ['on'] for the POST values
When I working with Django forms, I need to get the selected radio button id on submit. But when I log the value of post data I came to see that request.POST selected radio as 'sample': ['on']. template/detail.html <form action="{% url 'polls:vote' question.id %}" method="post"> {% csrf_token %} <input type="radio" name="sample" id="r1"> <label for="r1">Radio 1</label> <input type="radio" name="sample" id="r2"> <label for="r2">Radio 2</label> <br> <input type="submit" value="Vote"> </form> views.py print (request.POST) print result <QueryDict: {'csrfmiddlewaretoken': ['exomyfdxW1uPeZtZA46SgWG9UVxX8iY6SGypagSDmkYdeFcifCOXRiXQv2TIgp2A'], 'sample': ['on']}> Why is that coming like that is there any problem in my code. -
DRF - Authentication credentials were not provided
I am testing django rest framework using python requests module but its says an error. I am just beginner rest-api developer. DRF setting main.py import datetime REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', 'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.TokenAuthentication', # 'rest_framework.authentication.BasicAuthentication', ), 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.IsAuthenticatedOrReadOnly', ) } JWT_AUTH = { 'JWT_ENCODE_HANDLER': 'rest_framework_jwt.utils.jwt_encode_handler', 'JWT_DECODE_HANDLER': 'rest_framework_jwt.utils.jwt_decode_handler', 'JWT_PAYLOAD_HANDLER': 'rest_framework_jwt.utils.jwt_payload_handler', 'JWT_PAYLOAD_GET_USER_ID_HANDLER': 'rest_framework_jwt.utils.jwt_get_user_id_from_payload_handler', 'JWT_RESPONSE_PAYLOAD_HANDLER': 'rest_framework_jwt.utils.jwt_response_payload_handler', 'JWT_ALLOW_REFRESH': False, 'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=7), 'JWT_AUTH_HEADER_PREFIX': 'JWT', # Authorization: JWT <token> 'JWT_AUTH_COOKIE': None, } and my testing code is import os import json import requests AUTH_ENDPOINT = 'http://127.0.0.1:8000/api/auth/jwt/' ENDPOINT = 'http://127.0.0.1:8000/api/status/' image_path = os.path.join(os.getcwd(), 'drf.png') headers = { "Content-Type": "application/json" } data = { "username": 'jaki', "password": 'SADHIN101119' } r = requests.post(AUTH_ENDPOINT, data=json.dumps(data), headers=headers) token = r.json()['token'] headers = { "Content-Type": "application/json", "Authorization": "JWT" + token } post_data = json.dumps({"content": "some random content"}) posted_response = requests.post(ENDPOINT, data=post_data, headers=headers) print(posted_response.text) Error showing {"detail":"Authentication credentials were not provided."} How can i solve the problem. Thanks. -
ValueError - Python Django
I went through forums and did some changes in my codes but the problem is still there. I did migrate and makemigrations, and even deleted migrate and recreate it again. I also added default=0 to the models.py code: age = models.PositiveIntegerField(default=0) I'll appreciate you if you help me on this issue. These are some lines of codes, let me know if you need any other information. This is the error: ValueError at /basic_app/create/ invalid literal for int() with base 10: 'create' Request Method: GET Request URL: http://127.0.0.1:8000/basic_app/create/ Django Version: 2.1.2 Exception Type: ValueError Exception Value: invalid literal for int() with base 10: 'create' Exception Location: C:\ProgramData\Miniconda3\envs\myDjanEnv\lib\site-packages\django\db\models\fields\__init__.py in get_prep_value, line 965 Python Executable: C:\ProgramData\Miniconda3\envs\myDjanEnv\python.exe Python Version: 3.7.0 Python Path: ['C:\\Users\\Administrator\\Desktop\\django_lecture\\djan_advance\\advcbv', 'C:\\ProgramData\\Miniconda3\\envs\\myDjanEnv\\python37.zip', 'C:\\ProgramData\\Miniconda3\\envs\\myDjanEnv\\DLLs', 'C:\\ProgramData\\Miniconda3\\envs\\myDjanEnv\\lib', 'C:\\ProgramData\\Miniconda3\\envs\\myDjanEnv', 'C:\\ProgramData\\Miniconda3\\envs\\myDjanEnv\\lib\\site-packages'] This is __init__.py file, line 960-965: def get_prep_value(self, value): from django.db.models.expressions import OuterRef value = super().get_prep_value(value) if value is None or isinstance(value, OuterRef): return value return int(value) The models.py file: from django.db import models # Create your models here. class School(models.Model): name = models.CharField(max_length=128) principal = models.CharField(max_length=128) location = models.CharField(max_length=128) def __str__(self): return self.name class Student(models.Model): name = models.CharField(max_length=128) age = models.PositiveIntegerField() school = models.ForeignKey(School,related_name='students',on_delete=models.PROTECT) def __str__(self): return self.name urls.py file in basic_app folder: from django.conf.urls … -
List Django database table names from external script
I am trying to access sqlite3 database that I have in my Django project from within external script that is not part of the project. However, the following will return an empty list: con = sqlite3.connect('database.db') cursor = con.cursor() cursor.execute("SELECT name FROM sqlite_master WHERE type='table';") print(cursor.fetchall()) Even though I have already saved some models to the database. To check the table names, I use the following in Django shell: >>> tables = connection.introspection.table_names() >>> seen_models = connection.introspection.installed_models(tables) >>> seen_models {<class 'django.contrib.auth.models.Permission'>, <class 'django.contrib.sessions.models.Session'>, <class 'django.contrib.contenttypes.models.ContentType'>, <class 'explorer_api.models.Athlete'>, <class 'django.contrib.admin.models.LogEntry'>, <class 'django.contrib.auth.models.Group'>, <class 'explorer_api.models.Activity'>, <class 'django.contrib.auth.models.User'>} >>> tables ['auth_group', 'auth_group_permissions', 'auth_permission', 'auth_user', 'auth_user_groups', 'auth_user_user_permissions', 'django_admin_log', 'django_content_type', 'django_migrations', 'django_session', 'explorer_api_activity', 'explorer_api_athlete'] I have specified the table names explicitly in model's Meta, so I guess the table names are appname_modelname (explorer_api_activity and explorer_api_athlete). But why the empty list?