Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
ow to optimize properly queryset with multiple OR conditions?
Here I am trying to filer all the menus having at least one status True belonging to the current user. This below query works fine for now but query looks bit longer and has multiple OR conditions. I want to optimize my queryset. How can I do it here ? models class Menu(CommonInfo): name = models.CharField(max_length=200, unique=True) code = models.CharField(max_length=50, unique=True) class Right(CommonInfo): menu = models.OneToOneField(Menu, on_delete=models.CASCADE, related_name='right') user = models.ForeignKey(User, on_delete=models.PROTECT, null=True, related_name='user_rights') create = models.BooleanField(default=False) update = models.BooleanField(default=False) view = models.BooleanField(default=False) delete = models.BooleanField(default=False) approve = models.BooleanField(default=False) class Group(CommonInfo): name = models.CharField(max_length=200, unique=True) users = models.ManyToManyField(User, blank=True, related_name='user_roles') menus = models.ManyToManyField(Menu, blank=True, related_name='menu_roles') query def get_queryset(self): filtersets = Q(right__create=True) | Q(right__update=True) | Q(right__delete=True) | Q( right__view=True) | Q(right__archive=True) qs = Menu.objects.filter(right__user=self.request.user).filter(filtersets) return qs -
How can I add celery task results to django's database from an external worker
I'm new to celery. I have django + db running on one machine and want to distribute some long running tasks to another machine. The task computes some data that it needs to return. I imagine the process should look like this: User clicks "start" Task is created (via a signature object) and is sent to the broker (e.g. rabbitmq) The task function of the worker that is connected to broker gets called * The worker is another machine, does not share code with django and has no access to the database The worker slowly finishes the task, reporting progress via the task metadata (pollable via ajax) The worker returns the data as the return value of the task function How do I get the returned data and put into the django database? I have read keeping-results but it doesn't seem to match my situation... The task was started by a django http request handler. I have an AsyncResult object with a task ID. I don't want to call .get() on the same thread. Starting a new thread to do the same or poll .ready() seems absurd too. What I'm really after is some event or callback with the data … -
Unable to load static files - settings.py supposedly correctly configured
I have been trying to figure out why the static files are loading for quite a few hours by now , but still can't figure our whats wrong. Could you please let me know what you thing could be the cause ? The following are: My project structure: ├── example_project │ ├── __init__.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py | └── pages | ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── models.py │ ├── tests.py │ └── views.py ├── templates ├── home.html │ │──static ├── css ├── bootsrtap.min.css ├── js ├── images └── manage.py These are my settings.py(I haven't put STATIC_ROOT because I dont need to collectstatic): STATIC_URL = '/static/' STATICFILES_DIR=[ os.path.join(BASE_DIR,'static'), ] This is bootstrap.min.css: <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> This is the template where I am trying to load bootstap ( and other static files) in: {% load static %} {% for product in object_list %} <link rel="stylesheet" href="{% static 'css/bootstrap.min'%}"> <div class="card" style="width: 18rem;"> <img class="card-img-top" src="{% static 'products/images/pavoreal-beach-resort.jpg'%}" alt="Card image cap"> <div class="card-body"> <h5 class="card-title">{{product.name}}</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> … -
Django filter database with array and OR operator
I'm trying to filter database with Q objects. Here is my code: arr = [1,2,3,4,5] filter_obj = Q(key_value__in=arr) print(filter_obj) # (AND: ('key_value__in', [u'1', u'2', u'3', u'4', u'5'])) As you see it's an AND operator. I want to filter with OR operator within this array. How can I implement this? Note: We don't know the items in array. -
How submit a queri redirecting a form on django
im trying to send a value from my index to a list page where i have some filters. I can send the value but it take a MultiValueDictKeyError. I use Djagno 3.1.7, Jquery and ajax for this exercise. I think the error are in the ajax beacuse it return value "all" and the botton value. This is my index form html: <form action="wallacar_app/lista/" method="GET" class="trip-form"> <label for="tipos">Tipo</label><br> {% for tipo in tipos %} <button name="type_car" value="{{ tipo.type_car }}" id="{{ tipo.type_car }}" class="form-control px-3 btn-primary btn">{{ tipo.type_car }}</option> {% endfor %} </form> This is my list.html: <div class="col-sm-2 col-2"> <div class="form-group"> <label for="type_car">TIPO DE COCHE</label> <select class="form-control" id="type_car" url = "{%url 'wallacar_app:get_type' %}"> <option value='all' selected>TODOS LOS TIPOS</option> </select> </div> </div> <table class="table table-bordered" id="list_data" data-toggle="table" url = "{% url 'wallacar_app:listing' %}"> <thead> <tr> <th style="text-align: center;background-color: #007bff;" data-field="brand">RESULTADOS</th> </tr> </thead> <tbody id="listing"> </tbody> </table> The ajax code for list.html: $('#type_car').on('change', function () { // get the api data of updated variety if(this.value) send_data['type_car'] = this.value; else if(this.value == "all") send_data['type_car'] = ""; else send_data['type_car'] = this.value; getAPIData(); }); function getType() { // fill the options of provinces by making ajax call // obtain the url from the provinces select input … -
Django users can't login after I create an account but admin can
I register a user succesfully. But then when I try to login it says username or password is wrong. This only happens for normal users. Superadmin can login without any problem. login view def login(request): if request.method == 'POST': username = request.POST['username'] password = request.POST['password'] user = auth.authenticate(username=username, password=password) if user is not None: auth.login(request, user) messages.success(request, 'Logged in succesfully') return redirect('dashboard') else: messages.error(request, 'Username or password is wrong') return redirect('login') return render(request, 'accounts/login.html') register view def register(request): if request.method == 'POST': form = RegistrationForm(request.POST) if form.is_valid(): first_name = form.cleaned_data['first_name'] last_name = form.cleaned_data['last_name'] phone = form.cleaned_data['phone'] username = form.cleaned_data['username'] email = form.cleaned_data['email'] password = form.cleaned_data['password'] user = Account.objects.create_user(first_name=first_name, last_name=last_name, username=username, email=email, password=password ) user.phone = phone user.save() messages.success(request, 'Created an account succesfully!') return redirect('dashboard') else: form = RegistrationForm() context = { 'form': form } return render(request, 'accounts/register.html', context) If you want me to send any other code please specify so I edit the question -
How can I get the options from a model depending on the ForeignKey the User has selected in a form?
I'm kinda new to Python and Django in general and I'm trying to create a form to add some cars into my DB, problem is I have a model "Coche" with 2 Foreign Keys to another 2 models, BrandCoche and ModelCoche which at the same time, ModelCoche has a Foreign Key to BrandCoche. What I need is that each time I choose a Brand, the Model field updates in the form so it only shows the ModelCoches available for that Brand and instead, right now, it's showing all of the Models regardless of the chosen Brand. My guess is that it's possible doing some kind of query, but so far I've been searching and haven't found any possible way to do so. Any help is much appreciated ^^ models.py class BrandCoche(models.Model): brand = models.CharField(primary_key=True, max_length=20, verbose_name="Marca", validators=[MinLengthValidator(limit_value=3), RegexValidator(regex='^[a-zA-Z ][-]?[a-zA-Z ]+$')]) #PK def __str__(self): return self.brand class ModelCoche(models.Model): model = models.CharField(primary_key=True, max_length=30, verbose_name="Modelo", validators=[MinLengthValidator(limit_value=2), RegexValidator(regex='^[a-zA-Z0-9 ][-]?[a-zA-Z0-9 ]+$')]) #PK brand = models.ForeignKey(to=BrandCoche, on_delete=models.CASCADE) #FK con BrandCoche def __str__(self): return self.model class Coche(models.Model): #PK matricula = models.CharField(primary_key=True, max_length=8, verbose_name="Matrícula", validators=[RegexValidator(regex='^[0-9]{4}[-][A-Z]{3}$', message='Error, la matrícula debe seguir el siguiente patrón: ' + '0000-AAA')]) #FKs concesionario = models.ForeignKey(Concesionario, on_delete=models.CASCADE) #Relacion 1-N con el CIF de tabla … -
Order many-to-many field by date added
# models.py class Friend(models.Model): # The friends, sender first, reciever second friends = models.ManyToManyField(Profile) # accepted or rejected accepted = models.BooleanField(default=False) rejected = models.BooleanField(default=False) date_added = models.DateField(auto_now=True) time_added = models.TimeField(auto_now=True) def __str__(self): if self.accepted == False and self.rejected == False: return f'{" sent a request to ".join([i.user.username for i in self.friends.all()])}' else: if self.accepted == True and self.rejected == True: return f'{" was a friend of ".join([i.user.username for i in self.friends.all()])}' elif self.accepted == True and self.rejected == False: return f'{" is a friend of ".join([i.user.username for i in self.friends.all()])}' else: return f'{" was rejected as a friend by ".join([i.user.username for i in self.friends.all()])}' The friends field is a many-to-many field, Understanding my problem with an example: for example -> Profile object 'a' is created, and then Profile object 'b'. Now I add profile object 'b' in the friend field and then object 'a', but the field orders them in 'a' then 'b'... How do order them by time added. Thank you. -
Nginx ingress controller working for one path and failing for other in a Django-based app
So, I'm having a hard time trying to figure out how to make django-based app work with Kubernetes' Nginx ingress controller. The app works fine when it's exposed with NodePort or LoadBalancer, but not with the Ingress. The app has two paths: /admin and /static. With the code added below, everything in /admin is working, but /static content returns a 404. apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: django-ingress annotations: nginx.ingress.kubernetes.io/app-root: / spec: rules: - http: paths: - path: /admin pathType: Prefix backend: service: name: django-service port: number: 8000 - path: /static pathType: Prefix backend: service: name: django-service port: number: 8000 I'm trying to find out why example.com/admin/foo/bar returns a 200, but example.com/static/foo/bar returns 404. If instead of Ingress, I use just a NodePort service like the one below, both example.com:31000/admin/foo/bar and example.com:31000/static/foo/bar return 200. apiVersion: v1 kind: Service metadata: name: django-service spec: ports: - nodePort: 31000 port: 8000 protocol: TCP targetPort: 8000 selector: app: django type: NodePort -
Session wide filtering of querysets in Django admin for super user
I can't really find any good answers to my problem. I have several organisations in my Django application. I do admin work in the Django admin. It use autocomplete on most of my foreign key fields. It gets tedious to find the correct objects that belong to the correct organisations in the list. So I would like to have results filtered in autocomplete fields to the organisation the object belongs to. But since I choose organisation for an object when I create it the chosen object is not available on the server yet since it is not saved. There seems to be some hacks around there to get the value of the chosen field from the DOM and then do it all in Javascript. But that seems like a lot of work to maintain. What would be better for me is if I could choose which organisation I am currently working on. Then I would want the organisation field in forms to be prefilled and read-only to that organisation and all foreign keys field to be filtered for results to just the current organisation. What is the simplest way of implementing this. I have not found anything in the django … -
Integrity error during social signup using allauth
I am trying to implement a social signup/login using allauth. During the last step of the process I get this error: IntegrityError at /accounts/eventbrite/login/callback/ null value in column "verified" of relation "account_emailaddress" violates not-null constraint DETAIL: Failing row contains (13, myemail@gmail.com, null, t, 19377e28-bdeb-404e-b366-1d29d3c771d0). I am using evenbrite service. I don't know what is going and why I am getting a NULL instead of a boolean Can anyone point me where I can find a solution to this problem? -
How to calculate the width and height of the image and reseize it?
I'm trying to resize the image in Django. (The pixels specified in the image are 1024 pixels.) If the width or height of the image to be stored on the server is more than 1024 pixels long, consider 1024 pixels. The length of the remaining sides must be based on the original ratio. How can I re-size the original as above? -
Django test __str__(self) for ForeignKey
So I have this ForeignKey in my class Adress: class Adresse(models.Model): place = models.ForeignKey('Place', on_delete = models.CASCADE) def __str__(self): return self.place.city The ForeignKey comes from the Model Place: class Place(models.Model): city = models.CharField(max_length = 100) def __str__(self): return self.city When I run the server, everything works as intended and my Adress returns the Foreign Key from the other class. I want to know how to write a test for this, so far my test_models.py file is looking like this: class TestForeignKey(TestCase): def test_adress_str(self): testing_city = Adresse.objects.create(place.city = 'London') self.assertEqual(str(testing_city), 'London') but I get this Error: TypeError: Adress() got an unexpected keyword argument 'city' Anyone that can help? -
i cant delete the model object in django and the delete functionality is not working?
what i did was i created a modal from bootstrap and attached a confirm delete button and when clicked passes the pk of the item and in the view section, i created a delete view which has these parameters, def DeleteMask(request,pk): obj=models.Masks.objects.get(id=pk) obj.delete return render(request,'main/index.html') so when i render the main page again the item is still there and it is not gone,can someone explain what i did wrong? path('delete/<int:pk>/',views.DeleteMask,name='delete') and this is m button to delete which is present in a modal <a class="btn btn-danger" href="{%url 'delete' pk=mask.id%}"></a> -
Heroku push fails because it can't find module allauth
I am trying to push a Django app to to Heroku. I get the following error on trying to push to heroku remote: -----> Building on the Heroku-20 stack remote: -----> Using buildpack: heroku/python remote: -----> Python app detected remote: -----> Using Python version specified in runtime.txt remote: -----> Installing python-3.7.10 remote: -----> Installing pip 20.2.4, setuptools 47.1.1 and wheel 0.36.2 remote: -----> Installing dependencies with Pipenv 2020.11.15 remote: Installing dependencies from Pipfile.lock (a6086c)... remote: -----> Installing SQLite3 remote: -----> $ python manage.py collectstatic --noinput remote: Traceback (most recent call last): remote: File "manage.py", line 22, in <module> remote: main() remote: File "manage.py", line 18, in main remote: execute_from_command_line(sys.argv) remote: File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line remote: utility.execute() remote: File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py", line 377, in execute remote: django.setup() remote: File "/app/.heroku/python/lib/python3.7/site-packages/django/__init__.py", line 24, in setup remote: apps.populate(settings.INSTALLED_APPS) remote: File "/app/.heroku/python/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate remote: app_config = AppConfig.create(entry) remote: File "/app/.heroku/python/lib/python3.7/site-packages/django/apps/config.py", line 90, in create remote: module = import_module(entry) remote: File "/app/.heroku/python/lib/python3.7/importlib/__init__.py", line 127, in import_module remote: return _bootstrap._gcd_import(name[level:], package, level) remote: File "<frozen importlib._bootstrap>", line 1006, in _gcd_import remote: File "<frozen importlib._bootstrap>", line 983, in _find_and_load remote: File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked remote: ModuleNotFoundError: No module named 'allauth' … -
DRF error create() got multiple values for keyword argument 'hnid'
so I am building a pet blog project where my scenario is - my users will be able to post multiple images and audios if they want while doing so , am facing several problems - while trying to post through POSTMAN . I am getting an error saying create() got multiple values for keyword argument 'hnid' .. while querying using UUID , it is throwing , a String naming "HNUsers object (e3ec1a43-ebc4-47b9-bf2f-55967af8ea71)" where I just wanted UUID(e3ec1a43-ebc4-47b9-bf2f-55967af8ea71) but came with extra HNUsers object Here is my Profile model class HNUsers(models.Model): USERTYPE = ( (u'RU', u'REGULAR USER'), (u'HN', u'HN'), ) GENDER = ( (u'M', u'Male'), (u'F', u'Female'), (u'O', u'Other'), ) ip_address = models.CharField("IP Address" , max_length=100, blank=True, null=True) full_name = models.CharField("Full Name", max_length=100, null=True, blank=True) username = models.CharField("Username", max_length=100, null=True, blank=True) email = models.EmailField("Email", blank=True, null=True) user_type = models.CharField("User Type", max_length=2, choices=USERTYPE, null=True, blank=True, default=USERTYPE[0][0]) mobile_number = models.CharField("Mobile Number", max_length=20, blank=True, null=True) date_of_birth = models.DateField("Date of Birth", auto_now_add=False, blank=False, null=True) gender = models.CharField("Gender", max_length=1, choices=GENDER, blank=True, null=True, ) registration_date = models.DateTimeField("Registration Date", auto_now_add=True, null=True, blank=True) city = models.CharField("City", max_length=50, blank=True, null=True) country = models.CharField("Country", max_length=50, blank=True, null=True) profile_img = models.ImageField("Profile Image", blank=True, null=True) first_img = models.FileField("First Image", blank=True, null=True) first_img_url … -
Creating a ContentVersion in Salesforce from Django Application
I have some InMemoryUploadedFiles that users uploaded to my Django application. I need to pass these files' data encoded with base 64 as the VersionData when creating a ContentVersion object in Salesforce. If I pass in sample data such as fileData = base64.b64encode(b"testing"), everything works. The problem is trying to read/encode the data from Django's InMemoryUploadedFile If I pass in base64.b64encode(files[file].file.read()) as the VersionData (files[file] is the InMemoryUploadedFile - I'm looping through each one), it gives me the "bytes object is not JSON serializable" error. If I pass in the string version of that: str(base64.b64encode(files[file].file.read()), then the file gets uploaded but the contents are gibberish (aka a string of bytes). How do I format my InMemoryUploadedFile in such a way that I can pass the file's contents to the REST API call properly? More full code if it helps: def postFilesToDB(self, docRecords, files): payloadDict = {'passport_picture': { "name":"Passport Picture", "path":"", "data": None}, 'teudat_oleh': { "name":" Teudat Oleh", "path":"", "data": None }, 'tzav_giyus': { "name":"Tzav Giyus", "path":"", "data": None }, 'teudat_boded': { "name":"Teudat Boded", "path":"", "data": None }, } docTypeToPayloadEntry = { 'Passport Photo Scan': 'passport_picture', 'Teudat Oleh/Zakaut': 'teudat_oleh', 'Teudat Oleh/Zakaut - LSP Countries': 'teudat_oleh', 'Tzav Giyus': 'tzav_giyus', 'Teudat Boded': 'teudat_boded' … -
Separate documentations for internal and external APIs (drf_yasg)
I have two set of APIs: Internals, which are used in our client applications which we develop in our team, And externals, which is used by our business partners. I want to have a single document page which by authentication, shows internals APIs to our developers, and external APIs to every other viewer. How can I do that? I use: Django, DRF, and drf-yasg. P.S: I know this question is very general, but I do not have any clue where to start. I only guess some settings in get_schema_view, my views, and URL patterns are needed. -
Django - How turn string to link in template?
There is a model with name and link to their profile: from django.db import models class Person(models.Model): name = models.CharField(max_length=30) link = models.CharField(max_length=500) The table has the below values: name: Alex Link: www.example.com/alex name: Jo Link: www.example.com/jo In template I would like to get the hyperlink to the profiles. I tried the below, but got wrong link: <!DOCTYPE html> <html> <head> <title>Person</title> </head> <body> Name: {{ name }}, <a href="{{ link }}">Profile</a> </body> </html> It gives the link but the string is added to the end of the website address like this: http://www.website.com/person/www.example.com/jo How is it possible to fix this issue? -
Heroku Django install pillow
I have a problem with Heroku and Pillow i developed a apps with django and i have a columns with ImageField During the deploiement in heroku, i have a error message for pillow install with pip. error message: product.Profile.image: (fields.E210) Cannot use ImageField because Pillow is not installed. HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip install Pillow". Model django: class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) image = models.ImageField(null=True) Do you have a solution to my problem? Thank you -
Manage ListView and CreateView on the same template: how to submit data and update listView without reloading the page?
I want user to be able to add new record form a page and the list of records, that would be on the same page above, be updated without reloading the page (see attached picture below) For now, solutions I've read are to pass queryset (to display the list of records) in the context of createview But this way, user will submit, and page reloaded, for each new records... As User may have to enter hundreds of records, it is not a satisfactory solution so, maybe I should use Ajax to post new records and update the list of records But I wonder if Django has an in-a-box solution to resolve this problem? -
axios HTTP POST returns 400 undefined
I send data to an api with axios : function send_prefered_times_to_time_api(data){ axios({ method: 'post', url: 'https://modules.myadmin.com/api/time/calculate/', data: data, headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' } }).catch((error) => console.log( error.response.request._response ) ); console.log("data:",data); } but i get this error: POST https://modules.myadmin.com/api/time/calculate/ 400 undefined -
How to traverse multiple models properly in my queryset?
These are my models for the roles management(please suggest if you have better idea for this modeling). The problem here I get is while filtering only the menus which are assigned for the users. currently all the menus listed for the logged in user. What I want is list only menus if user has either create, update, delete, view status True. How can I do this ? The process of role assignment is. create role with some name(e.g Admin) assign users to the role assign menus and menu rights(create.update..) to the role. At login of user, if user is assigned to any role then I want to display that role's all menus if any create,update status is True. The current response "data": [ { "name": "Menu1", "code": "01", "can_update": true, "can_view": true, "can_delete": false, "can_approve": false, "can_create": true }, { "name": "Menu2", "code": "02", "can_update": false, "can_view": false, "can_delete": false, "can_approve": false, "can_create": false }, { "name": "Menu3", "code": "03", "can_update": false, "can_view": false, "can_delete": false, "can_approve": false, "can_create": false } ] } The response I want is: "data": [ { "name": "Menu1", "code": "01", "can_update": true, "can_view": true, "can_delete": false, "can_approve": false, "can_create": true }, ] } I want … -
How to add custom view page to django admin?
I have a parent-child models. It's kind of a coctail recipe, but it's about fish foods. I want to give a recipe calculator for each recipe. My current approach simply just add a link column at the list-view here is a snip of my admin.py class BahanCampuranAdmin(admin.ModelAdmin): list_display = ('name','_isfood', '_vubuy','_pbuy','userv','uconv','_bikin') fields = ('isfood','name', 'ubuy', 'vbuy','userv','uconv') readonly_fields = ['pbuy'] inlines = [ KomponenCampuranAdmin, ] def get_queryset(self, request): qs = super().get_queryset(request) return qs.filter(user=request.user) def _bikin(self,obj): if obj.ingridient.exists() : link="<a href='/catatkolam/recipecalc/{0}'>bikin</a>" return format_html(link, obj.id) return '-' _bikin.allow_tags=True _bikin.short_description='Bkin' ... This is what I got when clicking the link at the rightmost column. Look that it throw the user out of 'admin site' Here is my current template. {% extends "admin/base.html" %} {% block content %} <style> .Recipe-IngredientList { width: 250px; border: 1px solid #777; border-radius: 3px; padding: 5px; margin-top: 5px; } .Recipe-Ingredient { border-bottom: 1px solid black; padding: 5px 0; } .Recipe-Ingredient:last-child { border-bottom: none; } .Recipe-Ingredient span { font-weight: 600; } </style> <script> window.console = window.console || function(t) {}; </script> <script> if (document.location.search.match(/type=embed/gi)) { window.parent.postMessage("resize", "*"); } </script> <div> <label for="serving"> <h3>{{name}}</h3> <input type="number" id="servingInput" value={{vbuy}}> <span STYLE="font-weight:bold">{{ubuy}}</span> </label> <div class="Recipe-IngredientList"> {%for k in komponen%} <div class="Recipe-Ingredient js-recipeIngredient" data-baseValue={{k.qty}}>{{k.name}} : <span></span> … -
MariaDB replacing MySQL in Django
I have a project that was built using MySQL 5.4. But now I witched to MariaDB 10.3. If I understand correctly, the pip package mysqlclient==1.4.6 should still work on the new Database. Indeed, almost everythings works without problems with MariaDB on the webserver. However, I'd like to use MariaDB in my developement environment aswell. I'm using WAMP for the MySQL DB. In the phpMyAdmin landing page, I have to choose between MySQL and MariaDB databases. How can I tell Django to go to the MariaDB section? If I ignore that and just run manage.py check, I get the following errors: MySQLdb._exceptions.OperationalError: (1049, "Unknown database 'sampleDBmariaDB'") ... ... django.db.utils.OperationalError: (1049, "Unknown database 'sampleDBmariaDB'")