Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
run js on html element dynamically with Django(template)
I want to run price_update() function on h6 element {% for products in allProducts %} <div class="col-6"> Final Price: <h6 id="final_price_{{product.slug}}" onload="price_update({{products.price}},{{products.offer}}, {{product.slug}})"></h6> </div> <script type="text/javascript"> function price_update(price, offer, slug) { let discounted_price = price- parseInt(price * offer / 100); let id = "final_price_" + String(slug); let f_price = document.getElementById(id); f_price.innerText = discounted_price; } </script> {% endfor %} I got to know that onload cannot be used with <h6> . How can update innerText of <h6> for every product? -
Integrating BankID (Swedish payment service) into Python in Django
I'm pretty new to Django, but here goes. I want to integrate a third party verification service in my web app with Django, specifically BankID. BankID is a citizen identification solution that allows companies, banks and governments agencies to authenticate and conclude agreements with individuals over the Internet in Sweden. BankID should be used as login verification (BankID & Mobile BankID), see example website: https://e-tjanster.1177.se/mvk/login/login.xhtml I have read their developer guide: https://www.bankid.com/assets/bankid/rp/bankid-relying-party-guidelines-v3.4.pdf But I want to do this through Django. Django has a rest frame work, that I've been trying to use, but with no success: https://www.django-rest-framework.org/ Sample code of applied bankID in Python not through Django (I want to apply this below in Django): https://github.com/fiso/smooth-bankid/blob/master/README.md https://github.com/fiso/smooth-bankid/tree/master/examples/python My webapp: https://defreitasbolaget.herokuapp.com My Requirement.txt file is: boto3==1.9.96 botocore==1.12.96 certifi==2018.10.15 cffi==1.14.1 chardet==3.0.4 cryptography==3.0 dj-database-url==0.5.0 Django==2.1 django-crispy-forms==1.7.2 django-heroku==0.3.1 django-storages==1.7.1 docutils==0.14 gunicorn==19.9.0 idna==2.7 jmespath==0.9.3 Pillow==5.2.0 psycopg2==2.7.7 pycparser==2.20 pyOpenSSL==19.1.0 python-dateutil==2.8.0 pytz==2018.5 requests==2.19.1 s3transfer==0.2.0 six==1.12.0 urllib3==1.23 whitenoise==4.1.2 Concluding: I want to integrate BankID (Swedish version) into my Django Python Application. What is the best way to do this? Any help is appreciated. -
Django DRF PUT Request ImageField after GET request
How do I make a PUT request for an imageField after getting the data from the database. I receive the data in the form of a URL "/media/img.png" When I PUT the same data back, I get the error ["The submitted data was not a file. Check the encoding type on the form."] What is the best way to PUT this data. -
Getting list of ids from Django Haystack
I'm trying to get a list of record IDs from elasticsearch using django-haystack: queryset.values_list('id', flat=True) I found that all fields are requested and a SearchResult object is created for each record. For a large number of records, this takes a very long time. Is there a way to speed this up? Do not request all fields. Do not create objects, but immediately create a list of IDs. -
Django Export ManytoMnay fields in CSV
In my Django App I want to make simple reports by Exporting Data from Models to CSV. For the same I am trying django-import-export and it is very useful in exporting Models data as well as foreign key related data, but I am having difficulties getting the m2m related data. Models.py class Product(models.Model): name = models.CharField(max_length=500, default=0) short_code = models.CharField(max_length=500, default=0,unique=True) class KitProducts(models.Model): product = models.ForeignKey(Product, on_delete=models.CASCADE) quantity = models.IntegerField(default=0) class Kit(models.Model): kit_name = models.CharField(max_length=500, default=0) products = models.ManyToManyField(KitProducts) class AllotmentFlow(models.Model): flow = models.ForeignKey(Flow, on_delete=models.CASCADE) kit = models.ForeignKey(Kit, on_delete=models.CASCADE) asked_quantity = models.IntegerField(default=0) alloted_quantity = models.IntegerField(default=0) class Allotment(models.Model): transaction_no = models.IntegerField(default=0) dispatch_date = models.DateTimeField(default=datetime.now) send_from_warehouse = models.ForeignKey(Warehouse, on_delete=models.CASCADE) sales_order = models.ForeignKey(MaterialRequest, on_delete=models.CASCADE) flows = models.ManyToManyField(AllotmentFlow) is_delivered = models.BooleanField(default=False) Just for testing purpose I have mixed Resources add views like this: class PersonResource(resources.ModelResource): send_from_warehouse = fields.Field( column_name='send_from_warehouse', attribute='send_from_warehouse', widget=ForeignKeyWidget(Warehouse, 'name')) #foreignKey flows = fields.Field(widget=ManyToManyWidget(AllotmentFlow, field='flow') ) class Meta: model = Allotment def export(request): person_resource = PersonResource() dataset = person_resource.export() response = HttpResponse(dataset.csv, content_type='text/csv') response['Content-Disposition'] = 'attachment; filename="persons.csv"' return response But when I hit the URL the flow field comes empty in the CSV? I want to have the fields in my CSV like this: transaction_no dispatch_date send_from_warehouse sales_order flow_name kit_name asked_quantity alloted_quantity … -
How to create age-rang-filter form in Django?
I'm trying to design a form to allow user to filter data in run-time. My model is: class Case(models.Model): country = models.ForeignKey(Country, on_delete=models.CASCADE) city= models.ForeignKey(City, on_delete=models.CASCADE) name = models.CharField() birthdate= models.DateField() Then, I created a Model form with two extra fields ageFrom and ageTo so that user can enter two values (age rang) and get data filtered using this age range. This is my form class ReportForm(forms.ModelForm): #extra fields, which are not in my model, to filter by ageFrom = forms.IntegerField() ageTo = forms.IntegerField() def clean(self): cleaned_data = super().clean() ageFrom = cleaned_data.get("ageFrom") ageTo = cleaned_data.get("ageTo") if ageFrom > ageTo: raise forms.ValidationError("some message ") class Meta: model = Case fields = ('country','city', 'gender') template_name = 'report/custom_report.html' The problem is that the method clean doesn't work well. I don't get an error even the ageFrom > ageTo. Second I believe there is a better way to implement this filtering. Could you please help me to find the best way to filter by ages rang. Or to get the method clean work. -
Django: How can I input a foreign key to save a formset for which I have added forms dynamically with jQuery?
I am using modelFormsets to render forms to edit notes related to a project on a page. The Note model has a foreign key to relate to an instance of the Project model, and I render the forms with the existing instances of the Note model that belong to the project that the user is viewing. This works nicely. Now I am trying to add a new form client-side with jQuery. I basically modify the management data and clone all the elements that belong to that form, modify their attributes, and then insert them where it's appropriate. This worked too (in the frontend). However, I'm having trouble when submitting. Originally, I was only modifying the '#id_form-TOTAL_FORMS', and I got an error that says: 'django.db.utils.IntegrityError: null value in column "project_id" violates not-null constraint.', DETAIL: Failing row contains (63, 3, This is the third note, null), with 63 being the pk (assigned by the DB, I assume, because I didn't input anything for it), 3 being the note number, "This is the third note" being the note text (I wrote it in the form), and null, of course, being the foreignkey to the project id. Then I tried also updating the '#id_form-INITIAL_FORMS', … -
Django field choices and null=True
Is it right to use null=True in user_type? class UserType(models.IntegerChoices): CUSTOMER = 1 SHOP = 2 ADMIN = 3 user_type = models.PositiveSmallIntegerField( choices=UsertType.choices, default=UserType.CUSTOMER, null=True ) I want to know if the user_type has value in the first login in system and then choose user_type if it hasn't a value? Or it can be better to add defaul none value to UserType, like NONE = null or NONE = 0 ? How the best way it can be? -
Django: ManytoManyField used as a foreign key reference isn't showing in the database table
I am using a ManytoManyfield as a foreign key reference from another model in my 'Company' model but when I query the company table the many to many field isn't shown in the database. I was expecting at least a reference number of that key. But other foreign keys used are showing. """ Company Model """ class Company(models.Model): # choice fields STATUS = [ ('active', 'Active'), ('inactive', 'Inactive'), ('blocked', 'Blocked'), ('deleted', 'Deleted'), ] ACCOUNT_TYPE = [ ('distributor', 'Distributor'), ('personal', 'Personal'), ('retailer', 'Retailer'), ('point', 'Point'), ('manufacturer', 'Manufacturer') ] companyID = models.AutoField(primary_key=True, verbose_name='Company ID') companyAccountType = models.CharField(max_length=15, choices=ACCOUNT_TYPE, verbose_name='Acc. Type') companyStatus = models.CharField(max_length=10, choices=STATUS, default='active', verbose_name='Status') companyDetailTagLine = models.TextField(max_length=255, verbose_name='Tagline', null=True, blank=True) businessType = models.ManyToManyField( BusinessType, verbose_name='Business Types', blank=True, related_name='businessTypes2', ) Here businessType is a foreign key reference from BusinessType model """ Business Type Model """ class BusinessType(models.Model): businessTypeID = models.AutoField(primary_key=True, verbose_name='ID') businessTypeLabel = models.CharField(max_length=100, verbose_name='Title') businessTypeDesc = models.TextField(verbose_name='Desc') businessTypeImg = models.CharField(max_length=1000) I am trying to update Company model with data from CompanyDetail model where companyDetailBusinessType also exist. Though I have successfully updated other values, I am unable to update businessType. Is there any convenient way to update manytomanyfield with SQL? Thanks in advance. class CompanyDetail(models.Model): def all_values(self,obj,company_userinfo): data = { # … -
DRF Django Rest FrameWork: The Serializer is validating Data before my Validator can get to it
I am using a ModelSerializer and would like the Active field to be able to accept non-boolean fields. I have added a validator, but it only works for fields like 'yes' or 'no' that pass some kind of validation inside DRF. I poked around the DRF source code but cannot figure out where this hidden validation (and coercion from no --> False and yes --> True) is taking place. def validate_active(self, value): print('validating') if isinstance(value, bool): return value else: if value.lower() == 'yes' or value.lower() == 'true': value = True else: print(value) value = False return value def create(self, validated_data): print('this is the valid data') print(validated_data) return Card.objects.create(**validated_data) -
Django static throws Invalid block tag
I am trying to embed an ajax file into my django template. But it returns an error: >>> Invalid block tag on line 134: 'static', expected 'endblock'. Did you forget to register or load this tag? What causes this error? {% block javascripts %} <script src="{% static 'js/model-scripts/sampleAjax.js' %}"></script> {% endblock javascripts %} Here is my static declaration in the sites SETTINGS: STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static"), ] -
How to return multi-threading data as soon as the first thread result is available?
I am working on an application where I integrate multiple sources via wrappers and mediators. I am using thread for each source. The problem is that in Django I am still waiting when all the result from all the thread is available then I return it to the route. How can I return if any one of the thread finish it is working? I don't want to wait for all the threads. Finally, return each thread result when it is available. I highly appreciate your assistance. -
Semantic UI site.variables location?
I have a Django/Python application and I want to use semantic UI in my views. I'm importing semantic using the CDN link, so my base html file has the following header... <head> ... <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css"> <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300&display=swap" rel="stylesheet"> <link rel="stylesheet" href="{% static "styles.css" %}"> ... </head As you may see I want to load google fonts. However, all semantic UI elements seem to use the Lato,'Helvetica Neue',Arial,Helvetica,sans-serif font by default and this is difficult to override. All the advice I've seen online tells me to "customize the site.variables file". But where is this site.variables file? Is it something that I make, and if so, where do I put it so Semantic UI can detect it? -
Python Django: What does ValidationError: '[attribute_name]': {[ type instance with id [n] does not exist}] mean?
I'm not very technical and I'm trying to learn about automatic testing. I've been trying to run these tests but these errors keep on popping out on each of them. I'm just trying to create an object and modify a field value to test, but everytime I'm trying to assertRaises them it just stops and fails. Traceback error -
how to django category related tags
Thank you for reading. python 3.x, django 3 I have stack about how to related Category and Tags. For example Category [fruits, drink, meat] Tags [water, beef, apple, cola, orange, pear] I want to click category in fruits to show Tag for [apple, orange, pear] project/blog/context.py from .models import Category, Tag def related(request): context = { 'category_list': Category.objects.all(), 'tag_list': Tag.objects.all(), } return context project/project/settings.py TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], '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', 'blog.context.related', ### add project/blog/context.py ], }, }, ] project/blog/models.py from django.db import models """ category model """ class Category(models.Model): name = models.CharField('category', max_length=50) def __str__(self): return self.name """ Tag model """ class Tag(models.Model): name = models.CharField('tag', max_length=50) category = models.ForeignKey(Category, verbose_name='Parent-category', on_delete=models.PROTECT) # I guess this is related category def __str__(self): return self.name """ blog model """ class Blog(models.Model): title = models.CharField('title', max_length=50) text = models.TextField('text') category = models.ForeignKey(Category, verbose_name='category', on_delete=models.PROTECT) tag = models.ManyToManyField(Tag, verbose_name='tag') relation = models.ManyToManyField('self', verbose_name='related', blank=True) created_at = models.DateField('created', auto_now_add=True) updated_at = models.DateField('updated', auto_now=True) def __str__(self): return self.title project/blog/views.py from django.shortcuts import render, get_object_or_404 from .models import Category, Tag, Blog """ LIST """ def index(request): blog = Blog.objects.order_by('-id') return render(request, 'blog/index.html', {'blog': blog }) … -
Python socket programming for video streaming
I'm making a Django project where I want to use video broadcasting, Currently I'm using RTCMultiConnection for the broadcasting and it's socket.io server in the development environment. But I want to program my own socket server for the broadcasting. Can someone help to give me a head start on how I can achieve it. I want the project to be production ready. Regards. -
Django - values_list CSV
I'm trying to export CSV in Django and using values_list to select field i want to export. My First Try class ExportCSV(APIView): def get(self, request, *args, **kwargs): incidents = Incident.objects.filter( interview_date__range=(start, end), partner__twg=self.request.query_params.get('twg')) for incident in incidents: writer.writerow([ incident.incidenttwg1.getchild.values_list( # <-- This line 'choice', flat=True) ]) I got this. <QuerySet ['Hello', 'Gudbye']>, so i decide to create loop to fetch Hello and Gudbye. Here my second Try class ExportCSV(APIView): def getincident(self, request, incident): # Create a function for incident in incident.incidenttwg1.getchild.values_list('choice', flat=True): return incident def get(self, request, *args, **kwargs): incidents = Incident.objects.filter( interview_date__range=(start, end), partner__twg=self.request.query_params.get('twg')) for incident in incidents: writer.writerow([ self.getincident(request, incident) # Call function ]) I create a getincident function to make it cleanable to read. what i got is Hello, its suppose to be Hello and Gudbye not only Hello. Any Help?? Thanks.... -
Django restframework filter not working with foreignkey
i have setup volume with ForeignKey relationship filter-volume. i want to get filters of volume with min_volume and max_volume , but i'm getting wrong data whenever i execute the filters. it would be great if anyone could figure out where i doing thing wrong. models.py : class Cuboid(models.Model): title = models.CharField(max_length=80) volume = models.ForeignKey('FilterVolume', on_delete=models.CASCADE) def __str__(self): return self.title class FilterVolume(models.Model): volume = models.IntegerField(max_length=30) def __unicode__(self): return self.volume filters.py from django_filters import rest_framework as filters from crud_api.models import Cuboid class CuboidFilter(filters.FilterSet): min_volume = filters.NumberFilter(field_name="volume", lookup_expr='gte') max_volume = filters.NumberFilter(field_name="volume", lookup_expr='lte') class Meta: model = Cuboid fields = [ 'min_volume','max_volume' ] views.py class CuboidListApiView(generics.ListAPIView): model = Cuboid queryset = Cuboid.objects.all() serializer_class = CuboidSerializer filterset_class = CuboidFilter -
Why aren't the posts being published in templates?
Why aren't the posts being published in templates? I'm trying to create a stock blog page and right now in this project, I'm having problems with the template and the views, the thing is that I want to display the posts that have the same charfield as the url, but I don't understand why it is sending me to the else in the template, which says "sorry, this page does not exists" urls.py (I will only show the relevant one) from django.urls import path from app1 import views from .views import PostView, ArticleDetailView, AddPostView, UpdatePostView, DeletePostView, AddCategoryView, CategoryView, LikeView, MyPostsView, AddCommentView, UpdateCommentView, DeleteCommentView app_name = 'app1' urlpatterns = [ path('stock/<str:sym>/', views.StockView, name = 'stock'), ] views.py def StockView(request, sym): stock_posts = Post.objects.filter(stock=sym.lower()) return render(request, 'app1/stockview.html', {'stock':stock_posts}) models.py class StockNames(models.Model): name = models.CharField(max_length=255) symbol = models.CharField(max_length=255) def __str__(self): return self.symbol class Post(models.Model): title = models.CharField(max_length= 255) header_image = models.ImageField(null = True, blank = True, upload_to = 'images/') author = models.ForeignKey(User, on_delete=models.CASCADE) body = RichTextField(blank = True, null = True) #body = models.TextField() post_date = models.DateField(auto_now_add=True) category = models.CharField(max_length=255, default='coding') snippet = models.CharField(max_length=255) likes = models.ManyToManyField(User, related_name = 'blog_posts') stock = models.ForeignKey(StockNames, null=True, on_delete=models.CASCADE) def total_likes(self): return self.likes.count() def __str__(self): return self.title … -
django I try do automatically insert data for everyday?
I try do automatically insert data for everyday morning! i stuck can not think class Consumer_order(models.Model): name = models.ForeignKey(Consumer, on_delete=models.CASCADE) ac_no = models.CharField(max_length=32) newspaper = models.ManyToManyField(Newspaper,related_name="Consumer_ac_no") added_date = models.DateField(max_length=32,auto_now_add=True) def __str__(self): return str(self.ac_no) class Daily_Cart(models.Model): ac_no = models.ForeignKey(Consumer_order, on_delete=models.DO_NOTHING) newspaper = models.ManyToManyField(Consumer_order,related_name="Consumer_ac_no") added_date = models.DateTimeField(max_length=32,auto_now_add=True) def __str__(self): return str(self.added_date) def start(self, *args, **kwargs): date_object = datetime.date.today() crontab(minute=30, hour='7', day_of_week='mon,tue,wed,thu,fri,sat,sun') self.ac_no = self.Consumer_order.ac_no self.newspaper = self.Consumer_order.newspaper super(Daily_Cart, self).start(*args, **kwargs) scheduler.start() i use django celley also -
URL routing confusion while deploying Django Rest Framework backend + React web app?
I currently have a backend server built with Django Rest Framework and a frontend app built in React. When I run the server (with python manage.py runserver . waitress-serve app.wsgi:application or gunicorn app.wsgi:application), I can't access the admin page by appending /admin to the url. For some reason, my React app's url routing takes care of the routing and returns a 404. project.urls.py urlpatterns = [ path('admin/', admin.site.urls), path('api-auth/', include('rest_framework.urls')), path('rest-auth/', include('rest_auth.urls')), path('rest-auth/registration/', include('rest_auth.registration.urls')), path('accounts/', include('allauth.urls')), path('api/', include('items.urls')), re_path('.*', views.FrontendAppView.as_view()), ] views.py import os import logging from django.http import HttpResponse from django.views.generic import View from django.conf import settings class FrontendAppView(View): """ Serves the compiled frontend entry point (only works if you have run `npm run build`). """ index_file_path = os.path.join(settings.FRONTEND_DIR, 'build', 'index.html') def get(self, request): try: with open(self.index_file_path) as f: return HttpResponse(f.read()) except FileNotFoundError: logging.exception('Production build of app not found') return HttpResponse( status=501, ) What's causing this issue? -
How to make Django form field blank after submit?
I've created a django subscription form. I want to show a 'Thank You' message below the form after submitting but if I submit the form, email field is still showing the value. I've tried HttpResponseRedirect('/') but doing so doesn't show 'Thank You' message. #Views.py global categories categories = ['Development','Technology','Science','Lifestyle','Other'] class IndexView(TemplateView): model = Post template_name = 'blog/index.html' def post(self,request,*args,**kwargs): context = self.get_context_data() if request.method == 'POST': form = SubscriberForm(request.POST) if context["form"].is_valid(): context["email"] = request.POST.get('email') form.save() form = SubscriberForm() return render(request, 'blog/index.html', context=context) else: form = SubscriberForm() def get_context_data(self, **kwargs): # Call the base implementation first to get a context context = super(IndexView,self).get_context_data(**kwargs) # Add in a QuerySet of all the books context['post_list'] = Post.objects.all() context["categories"] = categories form = SubscriberForm(self.request.POST or None) # instance= None context["form"] = form return context #sidebar.html <div class="subscribe"> <form class="" action="" method="post"> {% csrf_token %} {{ form.as_p }} <button id="subscribe-button" type="submit" name="button"><i class="fa fa-paper-plane" aria-hidden="true"></i></button> </form> {% if email %} <h6>Thank you for Subscribing!</h6> {% endif %} <!-- <a href="#"><i class="fa fa-paper-plane" aria-hidden="true"></i></a> --> </div> #models.py class Subscribe(models.Model): email = models.EmailField() subscribed_on = models.DateTimeField(auto_now_add=True) class Meta: ordering = ('-subscribed_on',) def __str__(self): return 'Subscribed by {} on {}'.format(self.email, self.subscribed_on) #forms.py class Subscribe(models.Model): email = models.EmailField() subscribed_on … -
Is there a better way to compare Django model data with Django REST Framework response data?
I'm building an API using Django REST Framework. I find myself writing a lot of duplicate code to test the API views, so I decided to try to write a mixin class that I can add to test cases to cut down on time spent typing out repetitive tests. A really common test is that API response data match the objects stored in the database exactly. For example, one test might look like this: def test_list_object_response_returns_correct_json_data(self): objects = Object.objects.all() response = self.client.get(reverse('object-list')) response_json = response.json() for num, obj in enumerate(response_json): # convert JSON date strings to datetime objects obj_created = self.json_date_string_to_datetime(obj['created']) obj_updated = self.json_date_string_to_datetime(obj['updated']) self.assertEqual(obj['object_id'], str(objects[num].object_id)) self.assertEqual(obj['name'], objects[num].name) self.assertEqual(obj_created, objects[num].created) self.assertEqual(obj_updated, objects[num].updated) This passes, so I find myself using this pattern a lot to compare that a GET response matches all of the objects stored in the database. I learned that generalizing this pattern is complicated. Here's what I've come up with so far as a mixin (that also passes in test with both positive and negative test cases): class GetMixin(BaseMixin): # BaseMixin has some more general methods that help with API tests # regardless of HTTP request method @classmethod def response_and_model_data_are_equal(cls, response, model): # first, verify that model is … -
Which is the best python package to create interactive page or app?
I have experience in python but not in web based projects. I am really confused to select which one . My requirements are, I have created few utilities in python to automate my stuff Need to pass arguments from user interface with drop down option, radio button with constant values, file upload option Also need to have some static pages like detailed guidelines doc about various processes like Sphinx doc. Some interactive dashboard whereas data from csv Each functionalities from different drop down menu options or different tab Execute python script after file upload by clicking on some buttons and display some specific messages from running program Anyone across my network should use this to automate their stuff and I will extend this with lot more functionality and would like to keep all in one place I read about python Tkinter, Django, Flask . But I need suggestions to select the right package. Thanks in advance ! -
"detail": "No active account found with the given credentials" simplejwt
I am using Django rest API and trying to authenticate a user with username and password (obtain token pairs) with simpleJWT. In my settings.py I have added ''' REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.AllowAny', ), 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework_simplejwt.authentication.JWTAuthentication', ) } ''' ''' my urls.py is as below ''' urlpatterns = [ path('admin/', admin.site.urls), path('api/token/', TokenObtainPairView.as_view(), name ='token_obtain_pair'), path('api/token/refresh/', jwt_views.TokenRefreshView.as_view(), name ='token_refresh'), ] ''' However when I send a request to authenticate (register) a user and obtain token for that user it seems like it tries to verify the user instead and gives me the following error ''' { "detail": "No active account found with the given credentials" } ''' I have read multiple other related questions but nothing helped. What should I do to obtain a token for an email address and password?