Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
unable to get the data from url to do predictions in django rest api
I was trying to do predictions in drf and celery and my tasks.py file is @shared_task(bind=True) @api_view(['GET']) def predictions(self): solute = request.GET.get('solute') solvent = request.GET.get('solvent') mol = Chem.MolFromSmiles(solute) mol = Chem.AddHs(mol) solute = Chem.MolToSmiles(mol) solute_graph = get_graph_from_smile(solute) mol = Chem.MolFromSmiles(solvent) mol = Chem.AddHs(mol) solvent = Chem.MolToSmiles(mol) solvent_graph = get_graph_from_smile(solvent) delta_g, interaction_map = model([solute_graph.to(device), solvent_graph.to(device)]) return delta_g.detach(), torch.trunc(interaction_map).detach() and my views.py file is @api_view(['GET']) def result(request): response = {} results = predictions.apply_async() # response["interaction_map"] = (results[1].numpy()).tolist() # final_results = results.get() print(results.get(propagate=False)) # response["predictions"] = results[0].item() return Response({'result': results.get(propagate=False)}, status=200) I am getting error @api_view(['GET']) NameError: name 'api_view' is not defined. I know that loading the solute and solvent in the views.py file rectifies the problem. but I want to get them directly in the tasks.py file. If not possible I want to bring the solute and solvent to the tasks.py file. How can i do it? solute = request.GET.get('solute') solvent = request.GET.get('solvent') -
How to implement a hotel room pickup app?
I'm working on a Django app which would take data on the numbers of rooms sold in a hotel for each (future) date, on any given date, and use that data to determine pickup rate. For example, this is what the data for 12/22/2021 might look like: Date Rooms Sold Days Prior 12/23/2021 34 1 12/24/2021 19 2 12/25/2021 11 3 12/26/2021 10 4 12/27/2021 3 5 So on 12/22, the hotel had 34 rooms sold for the night of 12/23, 10 rooms sold for the night of 12/26, and so on. My goal for this app is to compare how the numbers are changing to determine the pickup rate for a given date. For example, if on 12/25 the hotel had 20 rooms sold for the night of 12/26, then I would be able to see that the pickup for that date/night was 10 rooms over the course of 3 days (because there was 10 rooms sold on 12/22). I would want dates to get flagged if there was a sudden pickup in rooms sold on that date, signaling a possible event and increase in demand for rooms that day. I'm just having trouble figuring out how I should … -
I have trouble in editing a post in django project
I am working on a Django project where I can create a post and also edit a specific post using the post's id. views.py @login_required def editpost(request,id): postform = NewPost.objects.get(id=id) if request.method == "GET": post = NewPostForm(request.GET, instance=postform) user = request.user.id timestamp = datetime.now() if post.is_valid: post = post.save() postdata = post.save(id = id,post = post,user = user,timestamp = timestamp) postdata.save() return HttpResponseRedirect(reverse("index")) return render(request,"network/postform.html",{ "postform" : postform, "id" : id, }) urls.py urlpatterns = [ path("", views.index, name="index"), path("login", views.login_view, name="login"), path("logout", views.logout_view, name="logout"), path("register", views.register, name="register"), path("postform", views.createpost, name="postform"), path("editform/<int:id>",views.editpost,name="editpost"), ] editform.html {% extends 'network/layout.html' %} {% block body %} <div style="margin: 70px 10px 10px 10px;"> <!-- <h1>Create New Post</h1> --> <div class="border border-success" style="margin: 10px 10px 10px 10px; position: relative;"> <div style="margin: 10px 10px 10px 10px;"> <label>New post</label> <form id="NewPostForm" action="{% url 'index' %}" method="GET"> {% csrf_token %} <div class="form-group"> {{ postform }} </div> <input class="btn btn-success" type="Submit" value="Submit"> </form> </div> </div> </div> {% endblock %} I have trouble routing my template. What should I do now!? -
Is it possible to not use styles.css for a specific div or tag, but instead use tailwind css?
I basically want to stop a div or a button from being influenced by my styles.css, since I want to only use tailwind css for that tag. Basically I want something like below, if it is possible: <button class="stop-being-influenced-by-styles.css flex border-0...other tailwind css">Button</button> Thank you, and please leave any comments if you have a question. -
How to deploy machine learning model
I have a trained model saved as main_model.sav, this model is trained based on phishing website dataset of 60 columns. Now I will like to deploy the model so that I can test any website of my choice. The online tutorial I have seen so far on deployment of machine learning model simply asks all the parameters used by the model to make prediction and when the user fills the information, the application will output the prediction.For example, this dataset used by this author will simply ask the user the Sepal_Length, Sepal_Width, Petal_Length and Petal_Width to get the class prediction which is extremely easy and similar to all I am seeing online. For the phishing website dataset, after been trained, it will only make sense to ask the URL alone and the model will predict if it's phishing or not just like phishtank. My question is that, how do we deploy a machine learning model that is trained with several X-columns (like 60 columns) and expected to get only one information (URL in this case) to make the binary prediction (phishing =1, not phishing =0)? Please I will appreciate it if there is any post (or guide) that I am … -
Django Rest Frame Work: passing User in djago rest frame work
I have a Django project as following code in model class Report(models.Model): created_by_user=models.ForeignKey(User,on_delete=models.CASCADE) following code in serializer class ReportSerializer(serializers.ModelSerializer): class Meta: model=Report fields='__all__' and following code in view class ReportCreateView(APIView): def post(self,request, *args, **kwargs): received_data=ReportSerializer(data=request.data) if received_data.is_valid(): received_data.save() return Response(received_data.data, status=status.HTTP_201_CREATED) return Response(received_data.errors,status.HTTP_400_BAD_REQUEST) when I send a post request by postman and send username and password in Authorization tab it error: { "created_by_user": [ "This field is required." ] } but if I type username or password incorrect it will be { "detail": "Invalid username/password." } can everybody help me? -
TypeError: Object of type DeferredAttribute is not JSON serializable
While testing my project, I found this weird error: Object of type DeferredAttribute is not JSON serializable... Before jump into the error, I want to tell what I wanted: Step 1: Registered User share his/her refer code so other person. Step 2: Unregistered person enters the code in the link. Step 3: The browser shows the button to continue to create account This is urls.py file ''' from django.contrib import admin from django.urls import path, include from core import views urlpatterns = [ path('admin/', admin.site.urls), path('', views.home), path('<str:code>/SS', views.home), path('accounts/', include('accounts.urls')), # path('', include('accounts.urls')), ] ''' This is views.py file ''' from django.shortcuts import render from accounts.models import Refer def home(request, *args, **kwargs): code = str(kwargs.get('code')) try: user = Refer.objects.get(referral_code = code) print(user.referral_code) request.session['ref_profile'] = Refer.id print('id', user.id) except: pass print(request.session.get_expiry_date()) return render(request, 'accounts/registration.html') ''' A simple home.html file ''' {% extends 'base.html' %} {% block title %} home {% endblock title %} {% block bodycontent %} {% if user.is_authenticated %} {{user}} {% else %} <p> "Hello Everyone" </p> <button class="btn btn-primary"><a href="{% url 'accounts:registration' %}">Create New User</a></button> {% endif %} {% endblock bodycontent %} ''' And I got this ''' Request Method: GET Request URL: http://127.0.0.1:8000/de829fab192047/ Django Version: 4.0.1 … -
Is it okay to have two base.html templates in django?
Is it okay to have multiple base.html templates in django? For instance, I would have one template that would extend from base_one.html and another template extending from base_two.html. For example, this is one of the templates: {% extends "base_one.html" %} {% block content %} {% endblock content %} and this is another template: {% extends "base_two.html" %} {% block content %} {% endblock content %} -
UNIT TEST- Django DRF - How to calling methods in ModelViewSets (Avoid 404 Error)
I am writing unit test code for viewsets. I often struggling for calling url to access my methods. here, views.py class AppraisalEmployeeAPI(viewsets.ViewSet): def get_permissions(self): if self.action in ['retrieve']: self.permission_classes = [IsOwnerPermission | IsHODPermission | IsHRUser | IsManagementUser] elif self.action in ['list']: self.permission_classes = [IsHRUser | IsManagementUser] return super(self.__class__, self).get_permissions() def list(self, request): # code return obj def retrieve(self, request): #code return obj urls.py router = routers.DefaultRouter() router.register('appraisal', AppraisalAPI) router.register(r'employee', AppraisalEmployeeAPI, basename='employee') urlpatterns = [ path('', include(router.urls)), ] test.py url = reverse('employee-list') self.client = Client(HTTP_AUTHORIZATION='Token ' + token.key) resp1 = self.client.get(url, format='json') self.assertEqual(resp1.status_code, 200) Here, I have got 404 page not found response. I dont know how to approach viewssets by using url routers. Expecting help for above issue and how to approach viewsets and router urls. Thanks in Advance,..... -
reverse(thing) django rest framework in a viewset
The main question is: What is the rest framework ViewSet friendly way to make the reverse routes? In a django cookiecutter site I have api_router.py with this router.register(r"users", UserViewSet) router.register(r"userprofile", UserProfileViewSet, basename="userprofile") router.register(r"student", StudentViewSet) urlpatterns = router.urls app_name = "api" print(f"we have routes") for route in router.urls: print(route) print(f"{reverse('student-list') = }") which errors out saying that reverse can't find student-list the student model.py has a StudentViewSet with the standard class StudentViewSet( RetrieveModelMixin, CreateModelMixin, ListModelMixin, UpdateModelMixin, GenericViewSet, ): so it should have the stuff needed to create the student-list the output of that print statement is showing student-list **** edited ....*** athenaeum_local_django | <URLPattern '^student/$' [name='student-list']> athenaeum_local_django | <URLPattern '^student\.(?P<format>[a-z0-9]+)/?$' [name='student-list']> athenaeum_local_django | <URLPattern '^student/(?P<userprofile__user__username>[^/.]+)/$' [name='student-detail']> athenaeum_local_django | <URLPattern '^student/(?P<userprofile__user__username>[^/.]+)\.(?P<format>[a-z0-9]+)/?$' [name='student-detail']> The end of the error is as follows: ahenaeum_local_django | File "/app/config/urls.py", line 29, in <module> athenaeum_local_django | path("api/", include("config.api_router")), athenaeum_local_django | File "/usr/local/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include athenaeum_local_django | urlconf_module = import_module(urlconf_module) athenaeum_local_django | File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module athenaeum_local_django | return _bootstrap._gcd_import(name[level:], package, level) athenaeum_local_django | File "<frozen importlib._bootstrap>", line 1030, in _gcd_import athenaeum_local_django | File "<frozen importlib._bootstrap>", line 1007, in _find_and_load athenaeum_local_django | File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked athenaeum_local_django | File "<frozen importlib._bootstrap>", line … -
Django Form is not processing properly and no error has been displayed
Trying to create an app that saves sales in different sateges for my team(similar to an ecommerce) however the form to add the account info is not saving the data... I review different options and use formset as well no changes. model.py TYPE=( ('delegated','Delegated'), ('not_delegated','Not Delegated') ) class Account(models.Model): agent_profile=models.ForeignKey(AgentProfile, on_delete= CASCADE) account_name=models.CharField(max_length=120) opp_type=models.CharField(max_length=20, choices=TYPE, default='not_delegated') bp_id=models.IntegerField() mdm_id=models.CharField(max_length=50, null=True,blank=True) AM=models.CharField(max_length=50,null=True,blank=True) def __str__(self): return str(self.agent_profile) forms.py from django.forms import ModelForm from .models import Account class AccountForm(ModelForm): class Meta: model=Account fields=[ #'agent_profile', 'account_name', 'opp_type', 'bp_id', 'mdm_id', 'AM' ] views.py def confirm_account_create_view(request): form=AccountForm(request.POST or None) context = { "form": form } next_ = request.GET.get('next') next_post = request.POST.get('next') redirect_path = next_ or next_post or None if form.is_valid(): instance=form.save(commit=False) agent_profile, agent_profile_created = AgentProfile.objects.new_or_get(request) if agent_profile is not None: opp_type = request.POST.get('delegate_opp', 'not_delegated_opp') instance.agent_profile = agent_profile instance.opp_type = opp_type instance.save() request.session[opp_type + "_opp_id"] = instance.id print(opp_type + "_opp_id") else: print("Please verify Form") return redirect("opps:confirm") if is_safe_url(redirect_path, request.get_host()): return redirect(redirect_path) return redirect("opps:confirm") urls.py (main app) path('orders/confirm/account', confirm_account_create_view, name='create_account'), form page(HTML) {% csrf_token %} {% if next_url %} {% endif %} {% if opp_type %} <input type='hidden' name='opp_type' value='{{ opp_type }}' /> {% endif %} {{ form.as_p }} <button type='submit' class='btn btn-default'>Submit</button> </form> confirm page(HTML) {% extends "base.html" … -
ImportError: cannot import name 'solvent' from partially initialized module 'api.views' in django rest api
I am using Django rest framework to do prediction on two strings and using celery to run inference. But I am getting error when trying to take solute and solvent from the result function into tasks.py file but I am getting error ImportError: cannot import name 'solvent' from partially initialized module 'api.views' My views.py file from .tasks import predictions @api_view(['GET']) def result(request): response = {} solute = request.GET.get('solute') solvent = request.GET.get('solvent') results = predictions.delay() response["interaction_map"] = (results[1].detach().numpy()).tolist() response["predictions"] = results[0].item() return Response({'result': response}, status=200) My tasks.py file @shared_task(bind=True) def predictions(self): mol = Chem.MolFromSmiles(solute) mol = Chem.AddHs(mol) solute = Chem.MolToSmiles(mol) solute_graph = get_graph_from_smile(solute) mol = Chem.MolFromSmiles(solvent) mol = Chem.AddHs(mol) solvent = Chem.MolToSmiles(mol) solvent_graph = get_graph_from_smile(solvent) delta_g, interaction_map = model([solute_graph.to(device), solvent_graph.to(device)]) return delta_g, torch.trunc(interaction_map) -
Is it possible to implement a GUI (written in Python) in Django so I can use that GUI in the browser?
I have made a programme with GUI written in Python that uses: (as input data) excel file pandas beautifulsoup requests and web-scraping: for collecting actual currency exchange rates SkPy API: for sending the good news to my friends via skype I'd like to know is it possible to somehow migrate it to Django, so I can use it by webpage instead of in Windows/Ios? As Django's APP, in the admin sub-page. If so, what would be needed? I'm so excited to do it !!! :) -
Django: Search products starting with query => product_name__starswith=query
Products model class Products(models.Model): product_name = models.CharField(max_length=120) Queryset Products.objects.filter(product_name__startswith=query) I want to find all the products starting with search query only. For example: When I search for ca it returns car car cover and when I search for car cover, it only returns car cover But I want it to return car in the second search as well. Is there any possible way to do it? Please help me. Thank you. -
Hosting Static Files on Amazon Web Services > Amazon Bucket - Django - PNG - CSS files
I need to host my static files on AWS in order to sort out some problems I have been having with my Django website. I have been trying to solve this on and off for about a year now while finishing up the rest of the website but now it is the last thing to do and I can't put it off any longer. I have looked at the documentation and looked at so many videos with no luck. Below is everything I have including code and my bucket file configuration that pertains to this problem. Everything that I currently have running should be hosting all my static files on my Amazon Bucket, however, it isn't. I'm not getting an error but when I 'inspect' on google they are all being hosted locally. I have followed so many tutorials and started from scratch so many times and nothing is seeming to work. Thank You so much in advance.What is wrong with the configuration below? Is MEDIA_URL affecting it? P.S. = The gallery folder I have in my bucket is for images that users upload and those images are successfully being hosted on AWS and working fine it's just the static. … -
Upgrading to Django 4.0.1 from Django 3.2.10 - "got both positional and keyword arguments for field" error message
I'm trying to update a Django project from version 3.2.10 to 4.0.1 When running the tests, I'm getting this error: File "/Users/akira/Projects/work/speedy/cash_flow/jobs/bank_account/process_flinks_transactions_job.py", line 63, in __init__ super(ProcessFlinksTransactionsJob, self).__init__(*args, **kwargs) File "/Users/akira/.local/share/virtualenvs/speedy-kJQJ8v9W/lib/python3.8/site-packages/django/db/models/base.py", line 446, in __init__ raise TypeError( TypeError: ProcessFlinksTransactionsJob() got both positional and keyword arguments for field 'name'. The code that's raising the error is: class ProcessFlinksTransactionsJob(Job): objects = ProcessFlinksTransactionsJobManager() def __init__(self, *args, **kwargs): kwargs.update({"name": ProcessFlinksTransactionsJob.__name__}) super(ProcessFlinksTransactionsJob, self).__init__(*args, **kwargs) How would I go about fixing this error? -
django inline formset for nested models
I have three models: Devices, Location and LocationMapping while LocationMapping is connecting Devices with Locations. I want to create DeviceForm but don't know how to add Location to it using inline formset. Is it possible with three models? class Device(models.Model): name = models.CharField(max_length=255) description = models.TextField(blank=True, null=True) class Location(models.Model): name = models.CharField(max_length=255) roomnumber = models.CharField(max_length=255, blank=True, null=True) building = models.CharField(max_length=255) class LocationMappings(models.Model): device = models.OneToOneField(Device, models.DO_NOTHING) location = models.ForeignKey(Location, models.DO_NOTHING) I thought about somethinglike LocationMappingFormSet = inlineformset_factory(Device, LocationMapping, form=LocationMappingForm, extra=1 ) LocationFormSet = inlineformset_factory(LocationMapping, Location, form=LocationForm, extra=1 ) but i didn't work out. -
In Django, how to reload specific button params in without reload the page
I am creating a method of likes for a social network type website, currently I can update the likes if I reload the entire page every time the user likes it, but as in the rest of the websites it does not have this effect I would like to eliminate the reload but I have not been able to, I tried an asynchronous call but it only works on the first element and I would not know how to proceed to eliminate this update method in the likes my html for each card <div class="media pt-3 pl-3 pb-1"> <a href="{% url "users:detail" post.user.username %}"> <img class="mr-3 rounded-circle" height="35" src="{{ post.profile.picture.url }}" alt="{{ post.user.get_full_name }}"> </a> <div class="media-body"> <p style="margin-top: 5px;">{{ post.user.get_full_name }}</p> </div> </div> <img style="width: 100%;" src="{{ post.photo.url }}" alt="{{ post.title }}"> <p class="mt-1 ml-2" > <a style="color: #000; font-size: 20px;" id="like_heart" data-id="{{ post.pk }}" data-url="{% url 'posts:likes2' %}"> <i class="{% if request.user in post.likes_users.all %} fas fa-heart {% else %} far fa-heart {% endif %}" id="success_like"></i> </a> <i id="value_like">{{ post.likes_users.count }}</i> </p> <p class="ml-2 mt-0 mb-2"> <b>{{ post.title }}</b> - <small>{{ post.created }}</small> </p> </div> my ajax call $(document).ready(function(){ // ajax for call in post $("#like_heart").on("click",function(e){ // e.preventDefault(); … -
Django REST Method Destroy getting 404 not found when sending from axios
I have been trying and searching alot but no one had this problem apparently. So the problem is that i am trying to send an axios request to delete with the correct api ur and key. But DRF Model.ViewSet does not find the function with appropriate PK. Backend This is my view.py file: class GigList(ViewSet): def destroy(self, request, pk=None): print(pk) Gig.objects.filter(user=request.user, id=request.id).delete() return Response urls.py: router = DefaultRouter() router.register('api', views.GigList, basename='user') Frontend This is the js file where axios executes: async deleteGig(id) { const response = await api.delete(`api/destroy/${id}` + `/`,TokenService.getLocalAccessTokenHeader() ); return response } Django outputs: Not Found: /api/destroy/17/ [09/Jan/2022 23:44:46] "DELETE /api/destroy/17/ HTTP/1.1" 404 8064 If anyone has an hint or solution to this, i would be grateful, thanks guys -
How to find how many objects reference the same foreign key in Django
I'm creating a simple web app that uses Django as its backend. Currently, I have two models: Toy and Attributes. A toy contains a reference to an attribute. My goal is to return an error to the frontend whenever an attribute is going to be deleted but is still referenced by a toy. For example, a train toy could have the attribute "black". When I go to delete black, I should get a not possible error, since "black" is still referenced by the toy train. How would I go about checking the number of references an Attribute has? -
Django ajax how to get object href and image link?
I am implementing ajax in my list views page. Now I am facing problems for rendering image and object href. How to get my object href link and image src link from ajax? here is my code: views.py: class PostJsonListView(View): def get(self, *args, **kwargs): print(kwargs) upper = kwargs.get('num_posts') lower = upper - 1 posts = list(Blog.objects.values('id','title','body','blog_header_image')[lower:upper]) posts_size = len(Blog.objects.filter(is_published='published')) max_size = True if upper >= posts_size else False return JsonResponse({'data':posts,'max': max_size},safe=False) .html <div class="card mb-4" id="card mb-4"></div> <script> const postsBox = document.getElementById('card mb-4') console.log(postsBox) const spinnerBox = document.getElementById('spinner-box') const loadBtn = document.getElementById('load-btn') const loadBox = document.getElementById('loading-box') let visible = 1 const handleGetData = () => { $.ajax({ type: 'GET', url: `/posts-json/${visible}/`, success: function(response){ maxSize = response.max const data = response.data spinnerBox.classList.remove('not-visible') setTimeout(()=>{ spinnerBox.classList.add('not-visible') data.map(post=>{ console.log(post.id) postsBox.innerHTML += `<div class="card-body"> <h2 class="card-title"><a href="">${post.title}</a></h2> </div>` }) if(maxSize){ console.log('done') loadBox.innerHTML = "<h4>No more posts to load</h4>" } }, 500) }, error: function(error){ console.log(error) } }) } handleGetData() loadBtn.addEventListener('click', ()=>{ visible += 3 handleGetData() }) </script> How to get object href so user can click an view the details page? also how to render image url? -
define fields of Django ModelForm class on instantiation
I want my website-users to quickly adjust just one attribute of my model objects in a view (with htmx) (to avoid creating tons of ModelForms just with other fields attributes) that's why I want to create a ModelForm where I can define the displayed form fields on instantiation of the form in the view function, the desired field will be passed as a 'fieldlist' parameter into the view function , somehow like that: class ModelForm(ModelForm): class Meta: model = Model fields = --> how to put the at the ModelForm-instantiation (with a request passed) "fieldlist" parameter here? def __init__(self, *args, **kwargs): fieldlist = kwargs.pop('fieldlist') super(ModelForm, self).__init__(*args, **kwargs) any hints? -
How to send Crypto payments (programmatically) gotten through coinbase commerce
i have successfully integrated coinbase commerce into my django app for receiving cryptocurrency payment from the users. However the site payment process involves receiving payment from a User A which is intended for User B into the site coinbase commerce wallet and then only after User B has completely handed over whatever was the value/asset been paid for, then the payment would go on to be forwarded finally to User B. But the issue is that coinbase commerce has no facility for sending payments. and though payment can be sent with a python api on COINBASE, they are two seperate things and the money/coin in coinbase commerce would not be accessible from COINBASE even if it the same user/profile on the platform. Please does anyone have a solution to this problem...even if it does not use coinbase commerce, the only requirement is that it uses a crypto payment gateway -
Ajax / Django / jQuery - autocomplete titles and remove when user deletes what was typed into input
(Reposted from Reddit) I am in the early stages of generating an autocomplete (I would love for it to be a drop-down from the input I'm using, right now it's divs that are being prepended), when a user begins typing (once >2 characters reached). I had a version that would somewhat-correctly show these results that it's pulling from a massive database after typing into the input has begun. But when I added the "else if" close to the bottom with the intention of removing all divs that have been added once the user starts deleting the typed-in phrase, nothing is coming up now. This is the implementation of my js file as it currently stands: $(document).ready(function() { $( "#movie_titles" ).keyup(function(){ var movie_titles = $('#movie_titles').val(); var has_typed = false; if (movie_titles.length > 2) { $.ajax({ url: '/get_movies', type: 'POST', data: {'movie_titles': movie_titles, csrfmiddlewaretoken: '{{ csrf_token }}' }, dataType: 'json', success: function(response) { // var len = response.length; has_typed = true; $('#movie_titles').empty(); console.log(response) // for (var i = 0; i < len; i++) { $('#result-part').prepend('<div class="movie-title">' + response.title + '</div>'); // $(this).val(''); return false; } }); console.log(movie_titles); } else if (has_typed && movie_titles.length <= 2) { $('#result-part').remove(); } }); }); Any ideas … -
Django passwords changing by themselves
I have a really weird issue, I use django authentication and I use django AbstractUser. The problem is passwords are changing by themselves, I'm not even able to track when this change occurs, even if the App is not used, once I try to login again I can't it tells me the password is wrong, How did I know that the password changed ? I compared the SHA code in database, since I always use "admin" as password for the app. I have some password configs in my settings but I doubt it is linked to them : REST_AUTH_SERIALIZERS = { 'PASSWORD_RESET_SERIALIZER': 'forms.api.serializers.PasswordResetSerializer', } # Password validation AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] this is my User model class User(AbstractUser): ''' model for user extends default django user ''' MALE = 1 FEMALE = 2 GENDER_CHOICES = ( (MALE,'Male'), (FEMALE,'Female') ) gender = models.PositiveIntegerField(choices=GENDER_CHOICES,null=True) email = models.CharField(max_length=256,unique=True,blank=True,null=True) receive_emails = models.BooleanField(default=True) objects = CustomUserManager() created_date = models.DateTimeField(auto_now_add=True, blank=True, null=True) updated_date = models.DateTimeField(auto_now=True, blank=True, null=True) Can you please, if anyone has encountered this issue before, let me know and also if there is a solution to solve this. …