Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
DJango Python deployment on Heroku stopped working
We have django based python 3.7 version application was running properly on heroku but suddenly since 2 week all new deployment fails with following error. Its working on my local machine with runserver command. Here is errors logs for more reference. please help me as my prod app needs new changes to deployed and now everything is blocked. Updated Pipfile.lock (599d25)! Installing dependencies from Pipfile.lock (599d25)… To activate this project's virtualenv, run pipenv shell. Alternatively, run a command inside the virtualenv with pipenv run. Removing intermediate container 2125752d2f35 ---> a3b53b037080 Step 10/11 : RUN pipenv install --system ---> Running in fcb5350323a4 Installing dependencies from Pipfile.lock (599d25)… An error occurred while installing importlib-metadata==4.10.0 ; python_version < '3.8' --hash=sha256:92a8b58ce734b2a4494878e0ecf7d79ccd7a128b5fc6014c401e0b61f006f0f6 --hash=sha256:b7cf7d3fef75f1e4c80a96ca660efbd51473d7e8f39b5ab9210febc7809012a4! Will try again. An error occurred while installing zipp==3.7.0 --hash=sha256:9f50f446828eb9d45b267433fd3e9da8d801f614129124863f9c51ebceafb87d --hash=sha256:b47250dd24f92b7dd6a0a8fc5244da14608f3ca90a5efcd37a3b1642fac9a375! Will try again. Installing initially failed dependencies… [pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/dist-packages/pipenv/cli/command.py", line 254, in install [pipenv.exceptions.InstallError]: editable_packages=state.installstate.editables, [pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/dist-packages/pipenv/core.py", line 1874, in do_install [pipenv.exceptions.InstallError]: keep_outdated=keep_outdated [pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/dist-packages/pipenv/core.py", line 1253, in do_init [pipenv.exceptions.InstallError]: pypi_mirror=pypi_mirror, [pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/dist-packages/pipenv/core.py", line 862, in do_install_dependencies [pipenv.exceptions.InstallError]: _cleanup_procs(procs, False, failed_deps_queue, retry=False) [pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/dist-packages/pipenv/core.py", line 681, in _cleanup_procs [pipenv.exceptions.InstallError]: raise exceptions.InstallError(c.dep.name, extra=err_lines) [pipenv.exceptions.InstallError]: ['Collecting importlib-metadata==4.10.0 (from -r /tmp/pipenv-01ok21hj-requirements/pipenv-lkap3a1h-requirement.txt (line 1))'] [pipenv.exceptions.InstallError]: ['Could not find a version … -
Django ChoiceField get choice value in template
I have a radio button which is a yes / no. YES_NO_CHOICES = [(False,'No'),(True,'Yes')] I also have a choicefield in my ModelForm show_game = forms.ChoiceField(widget=forms.RadioSelect, choices=YES_NO_CHOICES, required=True) I dislike the HTML provided by Django; hence, I made a custom html with css which looks like this: <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="id_show_game" id="{{radio.id_for_label}}" value="{{radio.id}}" {% if forloop.counter0 == 0 %}checked="checked"{% endif %}> <label class="form-check-label" for="{{radio.id_for_label}}">{{radio.choice_label}}</label> </div> However, value is appearing empty: How do I access the value of radio which is a ChoiceField WITHOUT using the following: {{radio}} <- result from {% for radio in gameInfoForm.show_game %} {{form}} <- ModelForm type -
I can't center <textarea>
I try to center my <textarea> elements in my pet project but I can't find a way to do that. I have tried using the following approaches: Changing my textarea in CSS: textarea { display: flex; justify-content: center; align-items: center; } Using the text-align property: <div style="text-align: center"><textarea>I am <textarea></textarea></div> Using also <center> tag. Surprisingly, it worked. But I don't like this solution because it is condemned to use. Down here is link of the picture from my project (I can't post one due I don't have enough reputation). Here you can see I have two blocks: textarea provided by Django framework and standard HTML textarea. Both of them are not centered. (https://i.imgur.com/1AzKrWJ.png) Here is my code: <p>Write the reason(s) for refusal:</p> {% render_field form.refusal_reason placeholder="Text..." %} <div style="text-align: center"><textarea>I am <textarea></textarea></div> I have been finding for a solution for a long time but haven't succeed. I will be happy for any useful answer. -
Django - Displaying Images in Templates
I have a Django Website and I am currently working on a delete view that has to be a function-based view for later use. I need to display a name and an image in the template of the data I am deleting at that moment. I had it working as a class-based view but now I need it to be a function-based delete view. The code below works and displays the name but when it comes to the image(which is an image field so I cant just type in a URL in the src) it just displays that little miscellaneous image box on the screen and not my actual image. In the templates, if I put {{ image.url }} it displays nothing. How can I get and image to display in the template from a specific pk in a function-based view. views.py def deleterepo(request, pk): context = {} context['name'] = Add_Repo.objects.values_list('name', flat='True').filter(user=request.user).get(pk=pk) context['image'] = Add_Repo.objects.values_list('image', flat='True').filter(user=request.user).get(pk=pk) obj = get_object_or_404(Add_Repo, pk=pk) if request.method == "POST": obj.delete() return HttpResponseRedirect("/front_page/sheets/") return render(request, "sheets/repo/delete_repo.html", context) {{ name }} <img src="{{ image }}"/> -
Django. I can't download files
I am creating a function to download the created text file when the button is selected on HTML. I created it, but it doesn't download. Is it correct to understand that if this process is successful, it will be downloaded to the download folder? Can you help me? HTML <form action="" method="get"> <button class="btn btn-primary mt-1" type="submit" name="process">PROCESS</button> </form> views ・・・Preprocessing・・・ def downloadtest(readfile): with open(readfile, "r") as f: lines = f.readlines() for line in lines: print(line, end="") response = HttpResponse(f.read(),content_type="text/plain") response["Content-Disposition"] ='attachment; filename=readfile' return response tried lines = f.readlines() for line in lines: print(line, end="") We have also confirmed that the file exists and can be read by this process. -
Online waiting: django submit form and display result in same page
I have an emergent task to make a web page which allow user to input some data and the backend do some calculation and the result needs to be displayed in the same page just below the input field (like air ticket online price check). I am new to django and html. below is my first test web page of a simple online calculator to try to figure out how to make such web service. I found a problem that when clicking the "submit" button, it tends to jump to a new web page or a new web tab. this is not what I want. Once the user input the data and click "submit" button, I want the "result" field on the page directly show the result (i.e. partially update only this field) without refresh/jump to the new page. Also I want the user input data kept in the same page after clicking "submit". I saw there might be several different ways to do this work, iframe/AJAX. However, I have been searching/trying for answers and solutions for several days and none of the answers really work for this very basic simple question!! html: <form method="POST"> {% csrf_token %} <div> <label>num_1:</label> … -
how to collect static files and upload them s3 using django and zappa
I am using django and zappa (https://github.com/zappa/Zappa). I am trying to collect the static file of django and upload it to s3 and after running the command python manage.py collectstatic --no-input for some reason i keep getting these errors: ...raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (AccessControlListNotSupported) when calling the PutObject operation: The bucket does not allow ACLs ... raise err_cls("S3Storage error at {!r}: {}".format(name, force_str(ex))) OSError: S3Storage error at 'admin/css/widgets.css': An error occurred (AccessControlListNotSupported) when calling the PutObject operation: The bucket does not allow ACLs I have the following configuration: settings.py (i am using django_s3_storage) DEBUG=False ... S3_BUCKET = "my-bucket" STATICFILES_STORAGE = "django_s3_storage.storage.StaticS3Storage" AWS_S3_BUCKET_NAME_STATIC = S3_BUCKET STATIC_URL = "https://%s.s3.amazonaws.com/" % S3_BUCKET STATIC_ROOT = "https://%s.s3.amazonaws.com/" % S3_BUCKET AWS_DEFAULT_ACL = None the current aws user, is part of the group admin of users that i have created, which has administratorAccess policy and on top of that i have created the policy below that i have attached to the same group: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::my-bucket" ] }, { "Effect": "Allow", "Action": [ "s3:DeleteObject", "s3:GetObject", "s3:GetObjectAcl", "s3:PutObject", "s3:PutObjectAcl", "s3:CreateMultipartUpload", "s3:AbortMultipartUpload", "s3:ListMultipartUploadParts", "s3:ListBucketMultipartUploads" ], "Resource": [ "arn:aws:s3:::my-bucket/*" ] } ] } Also, i … -
How to update a wagtail UserProfile avatar (or other fields) alongside other CustomUser fields into one django form
I'm using Django and Wagtail to build a webapp. This webapp will be used by a group of members in which some will have admin permissions and most will not. I created a custom user model like so: class User(AbstractUser): bio = models.TextField( verbose_name=_("bio"), blank=True, help_text=_("Write a bit about yourself"), ) phone = PhoneNumberField( verbose_name=_("phone number"), blank=True, ) street_address = models.CharField( verbose_name=_("street address"), max_length=150, blank=True, ) city = models.CharField( verbose_name=_("city"), max_length=50, blank=True, ) I would like to leverage some fields that are provided by wagtail.users.models.UserProfile (as seen in https://github.com/wagtail/wagtail/blob/main/wagtail/users/models.py), like the avatar field, preferred_language field, etc for my own use. I know I can access those fields in my templates using user.wagtail_userprofile.avatar etc. What I'm looking to achieve, is to have a UserUpdateView that can update my User model, including some fields from wagtail.users.models.UserProfile into the same form, but I dont see how to do this. Regards! -
How can I quickly upload JSON data as a Django Model
for my project i will need to have a large food database. I'm planning to use USDA API witch returns data as JSON. Now when I'll pass the url with restricions about what nutrients I want to have that will correspond to fields in my Django model I'll save the data to a JSON file. Now here's my question, how can I quickly pass all that data to create database table in Django? My model: class Fruit(models.Model): name = models.CharField(max_length=255) calories = models.DecimalField(decimal_places=2, max_digits=5,blank=False, null=False) ... API url https://api.nal.usda.gov/fdc/v1/food/1750339?nutrients=203&nutrients=204&nutrients=205&api_key=DEMO_KEY Returned data (not all) { "fdcId":1750339, "description":"Apples, red delicious, with skin, raw", "publicationDate":"10/30/2020", "foodNutrients":{ "type":"FoodNutrient", "nutrient":{ "id":1003, "number":"203", "name":"Protein", "rank":600, "unitName":"g" }, "foodNutrientDerivation":{ "id":49, "code":"NC", "description":"Calculated", "foodNutrientSource":{ "id":2, "code":"4", "description":"Calculated or imputed" } }, "id":21115516, "amount":0.18750000, "max":0.25000000, "min":0.12500000, "median":0.18750000, "nutrientAnalysisDetails":[ ] } } My JSON file { "name": '', "calories": '', "protein": '', ... } I'm working on a python script for fetching data and stripping all the unnecessary fields but in the meantime I would like to hear from you how can I quickly transform my JSON file into Django model and save it to database. Is there maybe a django library for doing this? Or some method in manage.py … -
failed to connect to server aws
I don't know why I failed migrate my database to aws , I am putting everything right but where is the problem I really don't know django.db.utils.OperationalError: connection to server at "hereendpoint", port 5432 failed: Connection timed out (0x0000274C/10060) Is the server running on that host and accepting TCP/IP connections?``` -
Simplest django setup
I want to use django for a very simple project, basically a local project to navigate directories, and I'm basically just using it for its template language and ORM. I was wondering if I could do it all in a one-file setup as follows: manage.py (includes everything except html) main.html This approach works for everything minus loading django.models, which I think assumes a settings file is already imported before calling it. Here is what I have so far: #!/usr/bin/env python import os, sys from django.core.management import execute_from_command_line from django.conf.urls import patterns, url ### Settings os.environ.setdefault("DJANGO_SETTINGS_MODULE", "manage") ROOT_URLCONF = 'manage' TEMPLATE_DIRS = '.' DEBUG = True DATABASES={'default':{'ENGINE':'django.db.backends.mysql','NAME':'bookmarks','USER':'root','PASSWORD':'','HOST':'','PORT':'',}} urlpatterns = patterns('', url(r'^$', 'manage.main', name='main'),) ### Views def main(request): from django.shortcuts import render return render(request, 'main.html', {'hello': "Hello"}) ### Models # from django.db import models <-- everything works except this line # class Tag(models.Model): # name = models.CharField(max_length=30, primary_key=True) if __name__ == "__main__": execute_from_command_line(sys.argv) The error message I get is: File ".../django/db/init.py", line 11, in if DEFAULT_DB_ALIAS not in settings.DATABASES: Is there a simple way to get everything in one file? -
Django cannot connect to MySQL RDS server
GOAL Connecting EC2 Django API to RDS Architecture AWS VPC has two subnets 1 private with the RDS instance 1 public with my two EC2 servers Main server: Hosts Django API connected to an internet gateway Bastion server: Only authenticated SSH connections allowed, used for admin purposes on RDS instance Background I have established a successful connection on MySQL Workbench. SSH connection to EC2 server, then a connection to a MySQL RDS host is established. I am able to perform all C.R.U.D with this connection. When I try and recreate this process manually on the command line, I can’t. I SSH to the EC2 server then try and connect to the RDS with SSH to MySQL at the same endpoint, user, port, and password but it fails. When I try and run my Django server on the remove EC2 it also fails. I have the user, endpoint and password saved as environment variables. When I launch the Django Server it says connection failed. This is frustrating since I am almost certain my AWS VPCs are configured correctly because I am able to connect via MySQL workbench, but when I try and connect manually or with Django, it does not work. … -
Annotate quering, pk
I have ask, How should i querying when i use pk with annotate? I need redirect to user profile when a guest click in link. Models class Posty(models.Model): title = models.CharField(max_length=250, blank=False, null=False, unique=True) sub_title = models.SlugField(max_length=250, blank=False, null=False, unique=True) content = models.TextField(max_length=250, blank=False, null=False) image = models.ImageField(default="avatar.png",upload_to="images", validators=[FileExtensionValidator(['png','jpg','jpeg'])]) author = models.ForeignKey(Profil, on_delete=models.CASCADE) updated = models.DateTimeField(auto_now=True) published = models.DateTimeField(auto_now_add=True) T_or_F = models.BooleanField(default=False) likes = models.ManyToManyField(Profil, related_name='liked') unlikes = models.ManyToManyField(Profil, related_name='unlikes') created_tags = models.ForeignKey('Tags', blank=True, null=True, related_name='tagi', on_delete=models.CASCADE) class CommentPost(models.Model): user = models.ForeignKey(Profil, on_delete=models.CASCADE) post = models.ForeignKey(Posty, on_delete=models.CASCADE, related_name="comments") content1 = models.TextField(max_length=250, blank=False, null=False) date_posted = models.DateTimeField(default=timezone.now) date_updated = models.DateTimeField(auto_now=True) def __str__(self): return str(self.content1) Views if tag == None: my_tag = Posty.objects.annotate( latest_comment = Subquery(CommentPost.objects.filter(post=OuterRef('id')).values('content1').order_by('-date_posted')[:1]), my_author=Subquery(CommentPost.objects.filter(post=OuterRef('id')).values('user__user__username').order_by('-date_posted')[:1]), ) I got a correct username, but i cant got a correct redirect -
Two (Almost) Identacle Veiw.py Functions Behaving Differently
So, I am developing a cart system for an e-commerce website using Django. There are two separate functions for handling adding and removing cart items. (No I can't consolidate them into one function without changing my database and template structure) The first function, 'update_cart' is working just fine. It properly updates the appropriate model. However, the second function 'remove_item' is triggered when the user clicks the 'remove' button in the item list, and the function does in fact execute and redirect properly. However, it fails to update the many-to-many, foreign key-identified model object associated with the item. It's so weird because I'm accessing the object the same way in both functions. The only difference is that in the first uses .add() and the second .remove(). Also, the template is supposed to load the product's id into the GET data but doesn't show it in the URL like with the other template that triggers the 'update_cart' function. But it does show the mycart/?id=86 when the cursor is hovering over the button. (this is a chrome feature). It's very confusing. Can you guys help me to see what I am overlooking? Thanks for your time. :) view.py functions: def update_cart(request): context={} if … -
Django shell get models object function does not work any ideas?
i have tried to look at the django documentation but cant find what i am looking for. I have a django models, and in this model i have defined som logic, the problem is that i cant get the value when i try fetching the recepie through django shell. I want to se if the def recepie_status is working. My model: class Recepie(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) name = models.CharField(max_length=60, null=False, blank=True, verbose_name='Recepie name') description = models.TextField(max_length=500, null=True, blank=True, verbose_name='Description') created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) # slug = models.SlugField(max_length=255, verbose_name=_('Recepie Slug'), default=name) share = models.BooleanField(null=True, blank=True) def recepie_status(self): import datetime import date, timedelta, datetime status=(date.today()-timedelta(days=15)) if self.created_at > status: return "New" else: return "Old" i have done this in the django shell: >>> one = Recepie.objects.get(pk=1) >>> print (one.name) #this works >>> from datetime import timedelta, date, datetime >>> print (one.recepie_status()) throws this error in the django shell E:\Projekt\Fooders\fooders\recepies\models.py in recepie_status(self) 18 19 def recepie_status(self): 20 status=(date.today()-timedelta(days=15)) 21 if self.created_at > status: 22 return "New" ModuleNotFoundError: No module named 'date' -
Django Prevent that everyone can see /media Files
on my nginx server if people are using the /media path they can see a list of the whole folder with every file. How can I block that the people are seeing that, like with a 404 page. But I cant disable it in general because I refer to that path with images and stuff on other pages. So in conclusion I need to disable /media path for users but not for the server itself. I'm using django. Greetings and thanks for your help -
Adding 'graphene_django' in INSTALLED_APPS = [ 'graphene_django' ] of the settings.py file makes the django project to crush
Adding 'graphene_django' in INSTALLED_APPS = [ 'graphene_django' ] makes the django project makes the server to crush INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'graphene_django', "ingredients", ] Here is the error that appears from django.utils.encoding import force_text ImportError: cannot import name 'force_text' from 'django.utils.encoding' (/usr/local/lib/python3.9/site-packages/django/utils/encoding.py) -
How Can I Filter By Date Range Using Djangos Built in ListView?
I'm quite new to Django and everywhere I look seems to offer a solution that works for generic function based views, or really overcomplicates what i'm trying to do with a class based view. All I want to do is to filter out the results from a ListView to only include entries from a selected date range. For example I have a generic Class based view: class HomeView(ListView): model = Post template_name = 'home.html' that returns all of my blog posts and a very simple date selector on my home.html page: From date: <input type="date" name="fromdate"/> To Date: <input type="date" name="todate"/> <input type="submit" value="search"/> How can I take the input from the simple date range and alter my class based view to: IF a date range has been selected: only show posts from within that date range? Thank you in advance. I have checked and I can not see anywhere that has answered this on here that uses ListView or that doesn't overcomplicate the problem and become close to impossible to follow for a beginner Thank you -
unable to add model in custom context processor django
In my django project, I need to pass certain details from couple of models to all the views and realized that the best way to do this would be create a custom context processor file. the context processor works fine when passing harcoded values but throws django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. when trying to import model in the context processor file. project structure: accounts_engine | migrations | admin.py | apps.py | custom_processor.py | forms.py | models.py | tests.py | urls.py | views.py models.py class Role(models.Model): name = models.CharField(max_length=200) settings.py from accounts_engine import custom_processor TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['templates'], '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', 'accounts_engine.custom_processor.general_details', ], }, }, ] accounts_engine/custom_processor.py def general_details(request): return {'some_key1': 'some_value1', 'some_key2': 'some_value2'} this works fine but fails when I import account_engine.models.py here -
i have Django suit problem in install as decumentation
i have a problem when installing django suit by site documentation as steps first:- WARNING: You are using pip version 20.2.3; however, version 21.3.1 is available. You should consider upgrading via the 'f:\web-devolopment\python\django\venv1\scripts\python.exe -m pip install --upgrade pip' command. second :- and I am adding the code in ENSTALLED_APP third:- when import the library like ( from suit.apps import DjangoSuitConfig ) I have wavy line under from suit.apps import DjangoSuitConfig so the problem in install the library not working who can fix it . thank you -
Django URL with parameter not working with include
I am trying to pass a parameter to a url before my include statement. I think my problem should be similar to this one, but I can't figure out why mine isn't working. I get the error NoReverseMatch at /womens/ Reverse for 'shampoo' with arguments '('womens',)' not found. 1 pattern(s) tried: ['(?P<gender>womens|mens)/items/shampoo/$'] *config.urls* urlpatterns = [ re_path(r'(?P<gender>womens|mens)/items/$, include('items.urls')), ... ] *items.urls* urlpatterns = [ path('shampoo', views.shampoo, name='shampoo'), path('soap', views.soap, name='soap'), ... ] {% url 'items:shampoo' gender='male' %} I expect to get male/items/shampoo, but it doesn't work. Despite this, I can still manually go to male/items/shampoo. -
how to filter many-to-many fields in django models
I have 3 models: User , Tag and Recipe. User model is so basic and it's not important. Here is the Tag model: class Tag(models.Model): name = models.CharField(max_length=255) user = models.ForeignKey(settings.AUTH_USER_MODEL , on_delete=CASCADE) And here is the Recipe model: class Recipe(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL , on_delete=CASCADE) title = models.CharField(max_length=255) tags = models.ManyToManyField('Tag',) I made endpoint for all of these models but there is one problem! When I try to create a Recipe object, all of Tag objects will be listed, But I want to list just the logged in user tags. Here is my Tag serializer: class TagSerializer(serializers.ModelSerializer): class Meta: model = models.Tag fields = ('id' , 'name') extra_kwargs = { 'id' : { 'read_only' : True, } } And here is my Tag viewset: class TagsView(RecipeAttrsView): queryset = models.Tag.objects.all() serializer_class = serializers.TagSerializer authentication_classes = (authentication.TokenAuthentication,) permission_classes = (permissions.IsAuthenticated,) def get_queryset(self): return self.queryset.filter(user=self.request.user) def perform_create(self, serializer): serializer.save(user=self.request.user) How can I filter tags, so that all listed tag objects belong to the logged in user? -
Calling a function from a function
I have some logic within a view that I want to have rendered on multiple templates. How do I call the logic view from within another view and pass the data back to the view to be rendered? This is a simple test I was doing. def table_view(request): today = now().date() project_data = get_data_view context = {'projects_data':project_data} return render(request, "pages/project_table.html", context=context) def get_data_view(request): project_list = Project.objects.all() context = {"project_list":project_list} return {'context':context} The table view just renders a table, but the data within the table I want from the get_data_view I know I can write the logic within the same view, but some of my views contain a lot of code and don't want to be repeating the same code to retrieve the same data. -
ERROR: django.template.exceptions.TemplateSyntaxError: Invalid block tag on line 47: 'else'. Did you forget to register or load this tag?
How to solve problem How to solve problem How to solve problem -
How can I supress this type error from Django create_user?
I'm getting the following type error from pylance: from django.contrib.auth.models import User, AbstractUser from django.contrib.auth import get_user_model get_user_model().objects.create_user(**user_data) # ^- Cannot access member "create_user" for type "BaseManager[Any]" # Member "create_user" is unknown Pylance reportGeneralTypeIssues # User.objects.create_user(**user_data) # same error # AbstractUser.objects.create_user(**user_data) # same error For some reason it thinks AbstractUser.objects has a broader type BaseManager[Any] instead of UserManager, even though AbstractUser defines objects = UserManager(). The code works without errors when tested. Does anyone know how I can supress or get rid of this sort of type error?