Re: Improve performance about concurrency request with heavy tasks that make the server freeze and down.

2024-07-23 Thread Chrea Chanchhunneng
yes, I have. as you see the image I attached is the profiled for function 
increase the time after concurrency increase, all the function is using 
pillow and wandimage. 
On Saturday, July 20, 2024 at 6:01:53 AM UTC+9 Ryan Nowakowski wrote:

> Have you profiled your code to see what parts are taking longer as 
> concurrency increases?
>
>
> On July 18, 2024 11:26:25 PM CDT, Chrea Chanchhunneng <
> chreachan...@gmail.com> wrote:
>
>> I have an API that is built with S3 AWS. The API relate to the Image 
>> process with Face recognition.
>> I have a ModelSerializer. The create function of the serializer will get 
>> the Image from the body. The `image` will process with more functions are 
>> `convert_from_blob_to_png`, `create_thumbnail` and `create_watermark`. 
>> After each function is completed, I also need to upload each 4 images 
>> (including original image) to S3. And it has more functions like `face 
>> recognition` in this function. But the problem is when I request 5 or more 
>> requests in the same time the server will freeze and the function on image 
>> also increase running time. Below is the time that take while process the 
>> image. The result is second.
>>
>> [image: Screenshot 2024-07-18 at 11.44.35.png]
>>
>> The more I make concurrency requests, the more functions take time to run.
>> I wonder why it increases the time because the images are the same. Is 
>> there any way to debug or improve?  I use Pillow and wandImage for process 
>> on image.  The server is EC2. The server will freeze around 10 requests.
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/149dd641-99f3-472b-a4a4-b17bd1ac3fd2n%40googlegroups.com.


How to solve Access to fetch at 'https://api.amadeus.com/v1/flight-offers' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Response to preflight request doesn't pass access contro

2024-04-21 Thread Эля Min
I have this one:from django.middleware.common import MiddlewareMixin
from django.http import JsonResponse

class CorsMiddleware(MiddlewareMixin):
def process_request(self, request):
if request.method == "OPTIONS" and 
"HTTP_ACCESS_CONTROL_REQUEST_METHOD" in request.META:
response = JsonResponse({"detail": "CORS policy allows this 
request"})
response["Access-Control-Allow-Origin"] = "*"
response["Access-Control-Allow-Methods"] = "GET, POST, PUT, 
DELETE, OPTIONS"
response["Access-Control-Allow-Headers"] = "Content-Type, 
Authorization"
return response
return None

def process_response(self, request, response):
response["Access-Control-Allow-Origin"] = "*"
response["Access-Control-Allow-Methods"] = "GET, POST, PUT, DELETE, 
OPTIONS"
response["Access-Control-Allow-Headers"] = "Content-Type, 
Authorization"
return response 
AND:
CORS_ALLOWED_ORIGINS = [
'http://127.0.0.1:8000', ]
BEFORE I DID PROXY,but my project stopped before starting. Please give me 
HElp

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8b81f71d-f925-437a-9e39-4c1566b05709n%40googlegroups.com.


Can Django channel execute multiple consumers run in parallel per request to perform backend calculation

2023-09-06 Thread GP
 

Hi,
Want to know Django channel capability to perform back-end complex 
calculation by running multiple consumers for one request.
I am about to build one back-end calculation system under which for one 
client request there will be 1 job request and for that 1 job request can 
have upto 1k candidates (sometimes up to 10k). Doing calculation for 1k 
candidates at a time is very time consuming and load on database.

So in this case, can i create 10 consumers ( it can be many more or less 
based on no. of candidates under job request ) per 100 candidates and each 
consumer to process calculation for those 100 candidates.

Will this be possible with Django channel, if yes, then which protocol 
should i use WebSocket or http and why? do i need to create multiple 
channels? how much consumers can split max upto? how will i send response 
to after every consumer processing finished. i was referring this Worker 
and Background Tasks — Channels 4.0.0 documentation 
<https://channels.readthedocs.io/en/latest/topics/worker.html> but its not 
giving full confidence whether it is possible with this or not.
How will my Django channel system basic system architecture or is there any 
best way to handle this using Django?
Any help will really be really appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ffe64a52-a2d6-4cf8-8a7d-e80f6a9c0281n%40googlegroups.com.


Request for Django for Professionals book.

2023-08-31 Thread ALINDA Fortunate
Hello Team 👋.

I am done with Django for beginners.

Any one to share with me Django for professionals 4.0 please 🙏🙏🙏.

+256774339676

 "If you want to live a happy life, tie it to a goal, not to people or
things."

A graduate of Bachelors Degree of Science in Computer Science of Gulu
University.

@FortunateAlinda
Passionate about Python Development
And Computer related Dynamics

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPifpCsusrs_G_6MohxweNsabSrepGaiqjZQqQGNQ6OhRE9oOQ%40mail.gmail.com.


Request Time - Django - Nginx - Whisper(openai)

2023-06-05 Thread Swelan Auguste
Dear All,

I need some help with a project.

I am using whisper within a Django application and based on the audio file
I am trying to transcribe nginx would give me a request timeout error page
but the code still executes in the background and does transcribe.

Additionally, If I run the code without nginx with the Django development
server, it works each time and even with Jupyter Notebook or pure Python
code.

My question is, how can I stop the nginx timeout error or get the app to
delay or wait til the transcription is done?

https://github.com/swelanauguste/youtube-transcribe

Grateful for any assistance

Sincerely,

Swelan R. Auguste (Mr.)
758-489-3909
Swelan Auguste LinkedIn
<https://www.linkedin.com/in/swelan-auguste-92700522a/>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKj-ced7PZu4fK6Y1G5OXn6jXh-k49dgvSOQTqPz6Y1wprx01g%40mail.gmail.com.


Saving data from a post request using nested DRF serializers

2023-04-26 Thread Kimanxo
Here is my problem im gelreat details :
https://stackoverflow.com/questions/76112118/django-rest-frameworks-nested-serializers-post-request-foreignkey-error

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d7f8a1bc-437d-4e53-a6e0-0e85009478ean%40googlegroups.com.


Re: Django audio recording issue: receiving Bad Request error

2023-04-04 Thread Ahmed omar miladi
i have used it


On Tue, 4 Apr 2023 at 17:40, ritik sahoo  wrote:

> Have you used template inheritance?
>
>
>
>
> On Mon, 27 Mar, 2023, 9:27 pm Yong Zu Yi, <1208z...@gmail.com> wrote:
>
>> I am new to Django and also my first time building an application. I am
>> building an audio journaling application with Django.
>> What I am doing here is a recorder. When user press the recorder button,
>> it will direct to record.html with four buttons, Start, Pause, Resume and
>> Stop. When the user finished recording and hit the Stop button, it will
>> save a audio file (wav). However, I have receive a bad request error and
>> the audio file is not created.
>>
>> I have posted the code at stack overflow:
>> https://stackoverflow.com/q/75853749/21499403
>>
>> Can anyone help me please.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/4dd18add-5882-4864-ae99-4c079a17f347n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/4dd18add-5882-4864-ae99-4c079a17f347n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJwehCtakRR7ZCEHykPY5wq1CFUjPVfTNOLt3PBoYZJdeHTv1A%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJwehCtakRR7ZCEHykPY5wq1CFUjPVfTNOLt3PBoYZJdeHTv1A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE3Dc2MKiaJhYbYtzsBDfGCZrpxoM1UhdrqCppHYScbf5tSzZw%40mail.gmail.com.


Re: Django audio recording issue: receiving Bad Request error

2023-04-04 Thread ritik sahoo
Have you used template inheritance?




On Mon, 27 Mar, 2023, 9:27 pm Yong Zu Yi, <1208z...@gmail.com> wrote:

> I am new to Django and also my first time building an application. I am
> building an audio journaling application with Django.
> What I am doing here is a recorder. When user press the recorder button,
> it will direct to record.html with four buttons, Start, Pause, Resume and
> Stop. When the user finished recording and hit the Stop button, it will
> save a audio file (wav). However, I have receive a bad request error and
> the audio file is not created.
>
> I have posted the code at stack overflow:
> https://stackoverflow.com/q/75853749/21499403
>
> Can anyone help me please.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4dd18add-5882-4864-ae99-4c079a17f347n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4dd18add-5882-4864-ae99-4c079a17f347n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJwehCtakRR7ZCEHykPY5wq1CFUjPVfTNOLt3PBoYZJdeHTv1A%40mail.gmail.com.


Re: Django audio recorder Bad request: /record-audio/

2023-03-28 Thread Yong Zu Yi
Thank you for replying me. However, I still get the error Bad request: 
/record-audio/.

Also, I have a question, is it possible that after recording, it will just 
save to the database? Because what I have found that the only way to save 
media files into database is to upload it.

Thanks!

[image: error2.JPG]
On Tuesday, March 28, 2023 at 4:18:54 PM UTC+8 Tega Ukavwe wrote:

> I am currently neck-deep in work, I made the mistake of sending the 
> incorrect screenshot.
> I have corrected it, kindly view the screenshot attached to this email 
> instead.
> Thanks for understanding.
>
> Many Thanks,
> Tega Ukavwe
> Python Like English
>
> On Tue, Mar 28, 2023 at 9:10 AM Tega Ukavwe  wrote:
>
>> Apologies, the previous solution has a mistake in it, on line 27.
>>
>> Kindly refer to the attached screenshot.
>>
>> Thanks,
>> Tega Ukavwe
>> Python Like English
>>
>> On Tue, Mar 28, 2023 at 8:52 AM Tega Ukavwe  wrote:
>>
>>> Hi Yong Zu Yi,
>>>
>>> Based on the screenshot you provided, it looks like you're trying to 
>>> retrieve an audio file from the request's POST data using the 
>>> request.POST dictionary.
>>>
>>> However, audio files should be sent as part of the request's FILES data, 
>>> not POST data.
>>>
>>> To retrieve the audio file from the request's FILES data, you should use 
>>> the request.FILES dictionary instead.
>>>
>>> I have attached a screenshot of a modified code, I first check if the 
>>> audio file is present in the request.FILES dictionary. If it's not 
>>> present, I simply return a 400 Bad Request response. If it's present, 
>>> create a filename based on the current user's username and the current date 
>>> and time, and save the audio file to the server using the open function 
>>> and a for loop to write the file in chunks.
>>>
>>> I hope this helps you solve the issue you were facing. Let me know if 
>>> you have any further questions.
>>>
>>>
>>> Best Wishes,
>>>
>>> Tega Ukavwe
>>>
>>> Python Like English
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d42b52a2-67cd-4618-b048-74623e4cc5cfn%40googlegroups.com.


Django audio recording issue: receiving Bad Request error

2023-03-27 Thread Yong Zu Yi
I am new to Django and also my first time building an application. I am 
building an audio journaling application with Django. 
What I am doing here is a recorder. When user press the recorder button, it 
will direct to record.html with four buttons, Start, Pause, Resume and 
Stop. When the user finished recording and hit the Stop button, it will 
save a audio file (wav). However, I have receive a bad request error and 
the audio file is not created.

I have posted the code at stack overflow:
https://stackoverflow.com/q/75853749/21499403

Can anyone help me please.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4dd18add-5882-4864-ae99-4c079a17f347n%40googlegroups.com.


Request

2023-01-03 Thread Jadhav nandu naik
Hey guys add me in

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c1c3ac71-3089-45bc-952f-ca59ae095286n%40googlegroups.com.


Re: Django Request

2022-12-07 Thread Jorge Castro
 Hi friends. I write these lines for help as I am new in django. I built a
project and I deployed but for some razon, it doesn't work everey thing
fine. The main issue is that my store doesn't appear whit its items. The
site is solquimicas.tk

This is an spanish site, so tienda is the store

El mar, 22 nov 2022 a las 16:44, Alexander Neilson (<
alexan...@neilson.net.nz>) escribió:

> The answers will be somewhat joking like the ones above because it is so
> heavily dependent on how you code your application in django and the system
> you run it on.
>
> A super basic function that returns a static value to a browser may do
> huge numbers but that is not actual work (a static response it better
> written out once and a highly optimised HTTP server to fling it out of ram)
>
> The workload you actually perform on it will change performance numbers
> massively and the libraries you use, coding methodologies, etc.
>
> You could describe what you want to do with it and someone may have some
> experience with that sort of system who could give you some guidance. But
> in general any framework only has to be able to perform and scale to the
> needs of your system while working within the constraints you have, Django
> may be the perfect system for you, if you are making an API possibly with
> DRF. But another python framework may suit you better for your particular
> goals.
>
> This shows some of the massive range in performance of a basic function
> before some optimisation and after
> https://www.toptal.com/python/performance-optimization-testing-django
>
> Regards
> Alexander
>
> Alexander Neilson
> Neilson Productions Limited
>
> alexan...@neilson.net.nz
> 021 329 681
> 022 456 2326
>
>
> On Wed, 23 Nov 2022 at 09:10, nana kwame  wrote:
>
>> Please how many request (range of numbers of request) can Django process?
>>
>> On Tue, 22 Nov 2022 at 14:47, 'Kasper Laudrup' via Django users <
>> django-users@googlegroups.com> wrote:
>>
>>> On 22/11/2022 12.20, nana kwame wrote:
>>> > Please how many requests can Django process based on real test
>>> conducted.
>>>
>>> All of them.
>>>
>>> Kind regards,
>>>
>>> Kasper Laudrup
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/django-users/Ba2HwWZiKB0/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/b9779b25-6f0e-66a3-d441-69c2f437a8c5%40stacktrace.dk
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CALShLH%3DCK2sH1j8iiB3oKK5xPkASXYLx4A5UHo4Bv_evkyFchw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CALShLH%3DCK2sH1j8iiB3oKK5xPkASXYLx4A5UHo4Bv_evkyFchw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHYTDkSryWpKjbsYKww5dGcK0WC%3DBawO7sXZng4QA3ctPKrh0w%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHYTDkSryWpKjbsYKww5dGcK0WC%3DBawO7sXZng4QA3ctPKrh0w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2BF8c3AOyoWd1PpW7WyPgbYsCkbBX0Q_8pkoSFW4K4CE2d%3DYw%40mail.gmail.com.


Re: Forbidden (403) - CSRF verification failed. Request aborted.

2022-11-25 Thread Mark Gensler
Try adding your ngrok domain to the list of CSRF_TRUSTED_ORIGINS: 
https://docs.djangoproject.com/en/4.1/ref/settings/#csrf-trusted-origins

E.g. assuming you're using https:

CSRF_TRUSTED_ORIGINS = ["https://*.ngrok.io";]

On Wednesday, November 23, 2022 at 2:22:14 PM UTC dhana...@gmail.com wrote:

> Make your database as a public make format of database chmod 
> www-data=www-data ./filename 
>
> On Wed, 23 Nov, 2022, 7:33 am Chukwudi Onwusa,  wrote:
>
>> Check your template, immediately after the  opening tag add  
>> {% csrf_token %}
>> If you have it already, kindly check to ensure it's correctly spelt and 
>> placed and then restart your server.
>> Best Regards.
>>
>> On Wed, Nov 23, 2022, 00:58 Carlos Roberto  wrote:
>>
>>> Hi everyone!
>>>
>>> I use ngrok to make my projects available in django. I'm having trouble 
>>> accessing the admin page. After I enter the username and password I get the 
>>> error 403.
>>>
>>> Has anyone had the same problem and could help me?
>>>
>>> Regards
>>>
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/de5c4738-f540-4596-b1bf-0b0b16aabbf2n%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>
>>
>> On Nov 23, 2022 00:58, "Carlos Roberto"  wrote:
>>
>> Hi everyone!
>>
>> I use ngrok to make my projects available in django. I'm having trouble 
>> accessing the admin page. After I enter the username and password I get the 
>> error 403.
>>
>> Has anyone had the same problem and could help me?
>>
>> Regards
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/de5c4738-f540-4596-b1bf-0b0b16aabbf2n%40googlegroups.com
>>  
>> 
>> .
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAGoV8nm8QO1LKP4x7%2Bm%3DuM%3DMzdTryt-DYQOw%2BsdJREnm18c1gQ%40mail.gmail.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/680fc4f4-8b32-445d-9819-f93f00925ab5n%40googlegroups.com.


Re: Forbidden (403) - CSRF verification failed. Request aborted.

2022-11-23 Thread Nagaraja Tuticorin
Make your database as a public make format of database chmod
www-data=www-data ./filename

On Wed, 23 Nov, 2022, 7:33 am Chukwudi Onwusa, 
wrote:

> Check your template, immediately after the  opening tag add
> {% csrf_token %}
> If you have it already, kindly check to ensure it's correctly spelt and
> placed and then restart your server.
> Best Regards.
>
> On Wed, Nov 23, 2022, 00:58 Carlos Roberto  wrote:
>
>> Hi everyone!
>>
>> I use ngrok to make my projects available in django. I'm having trouble
>> accessing the admin page. After I enter the username and password I get the
>> error 403.
>>
>> Has anyone had the same problem and could help me?
>>
>> Regards
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/de5c4738-f540-4596-b1bf-0b0b16aabbf2n%40googlegroups.com
>> 
>> .
>>
>
>
> On Nov 23, 2022 00:58, "Carlos Roberto"  wrote:
>
> Hi everyone!
>
> I use ngrok to make my projects available in django. I'm having trouble
> accessing the admin page. After I enter the username and password I get the
> error 403.
>
> Has anyone had the same problem and could help me?
>
> Regards
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/de5c4738-f540-4596-b1bf-0b0b16aabbf2n%40googlegroups.com
> 
> .
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGoV8nm8QO1LKP4x7%2Bm%3DuM%3DMzdTryt-DYQOw%2BsdJREnm18c1gQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN1LePiRdJ7dDkNBse7qnsgefOfH%3DbUmVAQFF4khDdwno9kAeA%40mail.gmail.com.


Re: Forbidden (403) - CSRF verification failed. Request aborted.

2022-11-23 Thread Nagaraja Tuticorin
Make your database as a public make format of database chmod
www-data=www-data ./filename

On Wed, 23 Nov, 2022, 5:28 am Carlos Roberto,  wrote:

> Hi everyone!
>
> I use ngrok to make my projects available in django. I'm having trouble
> accessing the admin page. After I enter the username and password I get the
> error 403.
>
> Has anyone had the same problem and could help me?
>
> Regards
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/de5c4738-f540-4596-b1bf-0b0b16aabbf2n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN1LePiLOoBRdj1EimOEeZTDDx30BJCOEdzQsY6ryx1VGyTREw%40mail.gmail.com.


Re: Forbidden (403) - CSRF verification failed. Request aborted.

2022-11-22 Thread Chukwudi Onwusa
Check your template, immediately after the  opening tag add
{% csrf_token %}
If you have it already, kindly check to ensure it's correctly spelt and
placed and then restart your server.
Best Regards.

On Wed, Nov 23, 2022, 00:58 Carlos Roberto  wrote:

> Hi everyone!
>
> I use ngrok to make my projects available in django. I'm having trouble
> accessing the admin page. After I enter the username and password I get the
> error 403.
>
> Has anyone had the same problem and could help me?
>
> Regards
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/de5c4738-f540-4596-b1bf-0b0b16aabbf2n%40googlegroups.com
> 
> .
>


On Nov 23, 2022 00:58, "Carlos Roberto"  wrote:

Hi everyone!

I use ngrok to make my projects available in django. I'm having trouble
accessing the admin page. After I enter the username and password I get the
error 403.

Has anyone had the same problem and could help me?

Regards



-- 
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/de5c4738-f540-4596-b1bf-0b0b16aabbf2n%40googlegroups.com

.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGoV8nm8QO1LKP4x7%2Bm%3DuM%3DMzdTryt-DYQOw%2BsdJREnm18c1gQ%40mail.gmail.com.


Forbidden (403) - CSRF verification failed. Request aborted.

2022-11-22 Thread Carlos Roberto
Hi everyone!

I use ngrok to make my projects available in django. I'm having trouble 
accessing the admin page. After I enter the username and password I get the 
error 403.

Has anyone had the same problem and could help me?

Regards


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/de5c4738-f540-4596-b1bf-0b0b16aabbf2n%40googlegroups.com.


Re: Django Request

2022-11-22 Thread Alexander Neilson
The answers will be somewhat joking like the ones above because it is so
heavily dependent on how you code your application in django and the system
you run it on.

A super basic function that returns a static value to a browser may do huge
numbers but that is not actual work (a static response it better written
out once and a highly optimised HTTP server to fling it out of ram)

The workload you actually perform on it will change performance numbers
massively and the libraries you use, coding methodologies, etc.

You could describe what you want to do with it and someone may have some
experience with that sort of system who could give you some guidance. But
in general any framework only has to be able to perform and scale to the
needs of your system while working within the constraints you have, Django
may be the perfect system for you, if you are making an API possibly with
DRF. But another python framework may suit you better for your particular
goals.

This shows some of the massive range in performance of a basic function
before some optimisation and after
https://www.toptal.com/python/performance-optimization-testing-django

Regards
Alexander

Alexander Neilson
Neilson Productions Limited

alexan...@neilson.net.nz
021 329 681
022 456 2326


On Wed, 23 Nov 2022 at 09:10, nana kwame  wrote:

> Please how many request (range of numbers of request) can Django process?
>
> On Tue, 22 Nov 2022 at 14:47, 'Kasper Laudrup' via Django users <
> django-users@googlegroups.com> wrote:
>
>> On 22/11/2022 12.20, nana kwame wrote:
>> > Please how many requests can Django process based on real test
>> conducted.
>>
>> All of them.
>>
>> Kind regards,
>>
>> Kasper Laudrup
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/Ba2HwWZiKB0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/b9779b25-6f0e-66a3-d441-69c2f437a8c5%40stacktrace.dk
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALShLH%3DCK2sH1j8iiB3oKK5xPkASXYLx4A5UHo4Bv_evkyFchw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALShLH%3DCK2sH1j8iiB3oKK5xPkASXYLx4A5UHo4Bv_evkyFchw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHYTDkSryWpKjbsYKww5dGcK0WC%3DBawO7sXZng4QA3ctPKrh0w%40mail.gmail.com.


Re: Django Request

2022-11-22 Thread nana kwame
Please how many request (range of numbers of request) can Django process?

On Tue, 22 Nov 2022 at 14:47, 'Kasper Laudrup' via Django users <
django-users@googlegroups.com> wrote:

> On 22/11/2022 12.20, nana kwame wrote:
> > Please how many requests can Django process based on real test conducted.
>
> All of them.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/Ba2HwWZiKB0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b9779b25-6f0e-66a3-d441-69c2f437a8c5%40stacktrace.dk
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALShLH%3DCK2sH1j8iiB3oKK5xPkASXYLx4A5UHo4Bv_evkyFchw%40mail.gmail.com.


Re: Django Request

2022-11-22 Thread Eric 247ERICPOINTCOM
Good evening,

I would like a partner to work on a Django project.

It is a social media site for, I have created most of the parts. I just
need to implement a few things that I am struggling with.

Anyone willing to work with me?

*Kind Regards*

*Eric Bawakuno | Computer Engineer | Data Analyst **| 247ERICPOINTCOM |
247ericpointcom.co.za ** | +27 815152254
| eric...@gmail.com   | **29 Rochester Road, Observatory
| Cape Town, South Africa | 7925 *



On Tue, Nov 22, 2022 at 4:46 PM 'Kasper Laudrup' via Django users <
django-users@googlegroups.com> wrote:

> On 22/11/2022 12.20, nana kwame wrote:
> > Please how many requests can Django process based on real test conducted.
>
> All of them.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b9779b25-6f0e-66a3-d441-69c2f437a8c5%40stacktrace.dk
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFgqToWRsCp3j%2BEF8FcGNM%2B5vVWEN4kjt%3DinsipJoBTdpAx6sA%40mail.gmail.com.


Re: Django Request

2022-11-22 Thread 'Kasper Laudrup' via Django users

On 22/11/2022 12.20, nana kwame wrote:

Please how many requests can Django process based on real test conducted.


All of them.

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b9779b25-6f0e-66a3-d441-69c2f437a8c5%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Django Request

2022-11-22 Thread nana kwame
Please how many requests can Django process based on real test conducted.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3e11c1e9-6f57-4838-bd4c-3d45f8f605efn%40googlegroups.com.


Re: Random different values on each request

2022-11-19 Thread RANGA BHARATH JINKA
Hi,

You can use random module in python to generate random numbers

Thanks and Regards

J. Ranga Bharath
Cell: 9110334114


On Thu, 17 Nov 2022, 7:51 pm cs.s...@gmail.com,  wrote:

> Hello friends,
> I am trying to get 2 random values on each response using
> order_by('?')[:2], but getting the same response each time.  also tried
> RandomManager() as described here.
> https://stackoverflow.com/questions/962619/how-to-pull-a-random-record-using-djangos-orm
> , but still getting the same response.   (SQL query:  SELECT TOP 2 * FROM
> QuizBank ORDER BY NEWID())
>
> views.py:
> class GetEssayQuestion(APIView):
> def get(self, request):
> data = Quizbank.objects.all().filter(status=1,
> section=5).order_by('?')[:2]
> serializer = QuizbankSerializer(data, many=True)
> return Response(serializer.data)
>
> Appreciate any reference? Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/800a6bc3-9870-47dd-8f41-54f13de108bdn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/800a6bc3-9870-47dd-8f41-54f13de108bdn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK5m317RvY8e3zW-e1hHS5r66grz5KvztWuuwJ0KzvPTODAUKA%40mail.gmail.com.


Random different values on each request

2022-11-17 Thread cs.s...@gmail.com
Hello friends,
I am trying to get 2 random values on each response using 
order_by('?')[:2], but getting the same response each time.  also tried 
RandomManager() as described here. 
 
https://stackoverflow.com/questions/962619/how-to-pull-a-random-record-using-djangos-orm
 
, but still getting the same response.   (SQL query:  SELECT TOP 2 * FROM 
QuizBank ORDER BY NEWID())

views.py:
class GetEssayQuestion(APIView):
def get(self, request):
data = Quizbank.objects.all().filter(status=1, 
section=5).order_by('?')[:2]
serializer = QuizbankSerializer(data, many=True)
return Response(serializer.data)

Appreciate any reference? Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/800a6bc3-9870-47dd-8f41-54f13de108bdn%40googlegroups.com.


Re: request to post UnboundLocalError

2022-10-24 Thread Yusuf Olamilekan muktar
Hello,

The variable 'contact' on line 27 is messing with python as the model name
'contact' is not being recognized but instead, the variable is being
recognized.
I'd advise you to change the variable name. i.e.
contact = contact()
to
contact_var = contact(...)
contact_var.save()



[image: Mailtrack]

Sender
notified by
Mailtrack

10/24/22,
09:04:18 AM

On Sun, Oct 23, 2022 at 8:22 PM Deepak kumar  wrote:

> please check to pdf and send to my email dk9284...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ce32825e-f275-4735-af27-6626e19f60ban%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKvf1-pLy-jzv438t%2BOPiJV8UiomS3N2COi3s7Otgszu261LrQ%40mail.gmail.com.


Re: request to post UnboundLocalError

2022-10-23 Thread Jitendra kumar Patra
Declare the contact variable before the return statement

On Mon, 24 Oct, 2022, 00:52 Deepak kumar,  wrote:

> please check to pdf and send to my email dk9284...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ce32825e-f275-4735-af27-6626e19f60ban%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOAROfmd65WqGZVtGh2MPsa0q1G5rC9BAP%2BnL%3DSNgROR9%3DaMww%40mail.gmail.com.


Re: login()/logout() with valid user and request not attaching user to session

2022-10-22 Thread Jordan Edmunds
I figured out the issue. The django_sessions database *does* get updated
with entries when a login is successfully attempted. I'm not entirely sure
why I initially observed that it wasn't. I may have been checking the wrong
database. This is not an issue with django. I have tracked down the
underlying issue to be that the cookies and CSRF tokens were not being
transmitted on request/responses - this was an issue in my frontend. Now
(almost) fixed.

On Sat, Oct 22, 2022 at 11:05 AM Jordan  wrote:

> So I have some rather bizarre behavior on my hands - I am trying to use
> session authentication to login a user. I am able to login/logout through
> the django admin console just fine. However, when I explicitly call
> django.contrib.auth.login(), nothing happens. No errors are thrown, the
> login method executes to completion, but I am not logged in. I can tell
> because (1) When re-loading the user admin console it asks me to
> authenticate and (2) no changes are made to the Session object database. It
> looks exactly the same before the login call as after the login call.
>
> The same is true of logging out - neither method appears to be
> attaching/detaching users to sessions. I have replicated this behavior with
> non-superusers. No errors are ever thrown, but no sessions are ever added
> or deleted. This is utterly bizarre to me - and I don't know what to do.
> Any suggestions for debugging would be immensely helpful - obviously
> authentication is a critical part of our application, and I can't move on
> until I fix this.
>
> I have uploaded my settings.py in a repo below. Some notes on my
> configuration - I am using the email field as my username, and am using
> dj-rest-auth <https://dj-rest-auth.readthedocs.io/en/latest/index.html>
> for authentication. There seems to be nothing wrong with dj-rest-auth: when
> I pass in a valid email/password combination, it successfully calls
> django's authenticate() method, which creates a valid user object, and then
> passes it to django.contrib.auth.login() along with the request. No
> exceptions are thrown inside the login() function - which I verified by
> stepping through it line-by-line with breakpoints. I am using the default
> runserver command as my django server.
>
> Where is the actual code in the login() function that makes changes to the
> database? The only thing I can think of is that somehow the
> user_logged_in.send() signal is responsible, but this doesn't appear to be
> directly attached to any code I can find that could plausibly make database
> modifications.
>
> https://github.com/edmundsj/django_auth_debug
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1a73c0d9-da20-4d7e-8d65-50c279ccd5f2n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/1a73c0d9-da20-4d7e-8d65-50c279ccd5f2n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJkO6Yz%2BhSVo%2B0TH74AW%3DdyQhpPfBsoYW4Gxcv8cKf%3DEZmEqrA%40mail.gmail.com.


login()/logout() with valid user and request not attaching user to session

2022-10-22 Thread Jordan
So I have some rather bizarre behavior on my hands - I am trying to use 
session authentication to login a user. I am able to login/logout through 
the django admin console just fine. However, when I explicitly call 
django.contrib.auth.login(), nothing happens. No errors are thrown, the 
login method executes to completion, but I am not logged in. I can tell 
because (1) When re-loading the user admin console it asks me to 
authenticate and (2) no changes are made to the Session object database. It 
looks exactly the same before the login call as after the login call. 

The same is true of logging out - neither method appears to be 
attaching/detaching users to sessions. I have replicated this behavior with 
non-superusers. No errors are ever thrown, but no sessions are ever added 
or deleted. This is utterly bizarre to me - and I don't know what to do. 
Any suggestions for debugging would be immensely helpful - obviously 
authentication is a critical part of our application, and I can't move on 
until I fix this.

I have uploaded my settings.py in a repo below. Some notes on my 
configuration - I am using the email field as my username, and am using 
dj-rest-auth <https://dj-rest-auth.readthedocs.io/en/latest/index.html> for 
authentication. There seems to be nothing wrong with dj-rest-auth: when I 
pass in a valid email/password combination, it successfully calls django's 
authenticate() method, which creates a valid user object, and then passes 
it to django.contrib.auth.login() along with the request. No exceptions are 
thrown inside the login() function - which I verified by stepping through 
it line-by-line with breakpoints. I am using the default runserver command 
as my django server. 

Where is the actual code in the login() function that makes changes to the 
database? The only thing I can think of is that somehow the 
user_logged_in.send() signal is responsible, but this doesn't appear to be 
directly attached to any code I can find that could plausibly make database 
modifications.

https://github.com/edmundsj/django_auth_debug

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1a73c0d9-da20-4d7e-8d65-50c279ccd5f2n%40googlegroups.com.


Re: Job Request As A Software Developer

2022-10-19 Thread tomaž Ovsenjak
Greetings! 

I present to you a new platform for you to find django gigs/job 
https://djangodevs.com

You can: 
1. create developer profile
2. show off your work 
3. get contacted by businesses 

Join now at https://djangodevs.com

Br 

On Friday, September 2, 2022 at 4:50:48 AM UTC+2 go...@gobidasu.com wrote:

> Hi Onjomba,
>
> I noticed you have a strong, in-demand skill set. We'd love to have you 
> join our talent network of software developers, data scientists, and 
> designers, called LD Talent - ldtalentwork.com. By joining LD Talent, 
> you’ll have the following benefits:
>
> - Explore remote opportunities: both contract and full-time, with US-based 
> companies
> - Set your own hourly rate and work on your own schedule
> - Gain financial incentives upon posting new learnings on our Github/Blog 
> - blog.ldtalentwork.com
> - Get funded to build your own ideas through the LD Ventures wing
>
> Become a part of the network by sending your resume to 
> in...@ldtalentwork.com and learn more about how you can advance your 
> career. If you have any questions, here’s our bookable calendar - 
> ldtalentwork.com/contact/ . Thank you.
>
> Regards
> Gobi
>
> On Thu, Sep 1, 2022, 13:24 Onjomba Felix  wrote:
>
>> Hae,
>> I am humbly requesting if you have any job or referral to a job just tell 
>> me bellow is my Cover Letter and CV.
>> [image: WhatsApp Image 2022-08-30 at 21.03.40.jpg]
>>
>> -- 
>>
> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAJU16zc2C9BGiQaAEnrbUDLdXgL%2B4zFs%3DpJzfLJjKrsiD3BNDQ%40mail.gmail.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cd6421ee-4cae-43c2-bde9-0bded748655dn%40googlegroups.com.


Re: Job Request As A Software Developer

2022-09-01 Thread Gobi Dasu
Hi Onjomba,

I noticed you have a strong, in-demand skill set. We'd love to have you
join our talent network of software developers, data scientists, and
designers, called LD Talent - ldtalentwork.com. By joining LD Talent,
you’ll have the following benefits:

- Explore remote opportunities: both contract and full-time, with US-based
companies
- Set your own hourly rate and work on your own schedule
- Gain financial incentives upon posting new learnings on our Github/Blog -
blog.ldtalentwork.com
- Get funded to build your own ideas through the LD Ventures wing

Become a part of the network by sending your resume to i...@ldtalentwork.com
and learn more about how you can advance your career. If you have any
questions, here’s our bookable calendar - ldtalentwork.com/contact/ . Thank
you.

Regards
Gobi

On Thu, Sep 1, 2022, 13:24 Onjomba Felix  wrote:

> Hae,
> I am humbly requesting if you have any job or referral to a job just tell
> me bellow is my Cover Letter and CV.
> [image: WhatsApp Image 2022-08-30 at 21.03.40.jpg]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJU16zc2C9BGiQaAEnrbUDLdXgL%2B4zFs%3DpJzfLJjKrsiD3BNDQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMk8evnmoTNRq2ET-AwazYcvmTCHj1%3DQm184cHgZsgLhpWuJOA%40mail.gmail.com.


Re: Bad Request 400 in Django

2022-09-01 Thread Marcella Carvalho
Paste here your settings code

On Thu, Sep 1, 2022, 4:14 PM Eric smith  wrote:

> I have some issues in running django server.
>
> System check identified no issues (0 silenced).
> September 01, 2022 - 10:58:47
> Django version 4.0.1, using settings 'project.settings'
> Starting development server at http://127.0.0.1:8000/
> Quit the server with CTRL-BREAK.
> [01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
> [01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143
>
> Please help me if you are expert on it.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7034243a-72ba-47bb-a5a3-6c1bcdec67aan%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE2b%3DZF4hCt2-WOwwaTzWrRPJ4uPXnfZCazGeiEvgZe8tqPWSw%40mail.gmail.com.


Re: Bad Request 400 in Django

2022-09-01 Thread Jishnu Ramachandran
🤣🤣

On Thu, 1 Sep, 2022, 11:02 pm Lakshyaraj Dash, 
wrote:

> What ??? It's September not july
>
> On Thu, Sep 1, 2022, 22:29 subin  wrote:
>
>> I will look forward to meeting you on July 11
>>
>> On Thu, Sep 1, 2022 at 4:14 PM Eric smith 
>> wrote:
>>
>>> I have some issues in running django server.
>>>
>>> System check identified no issues (0 silenced).
>>> September 01, 2022 - 10:58:47
>>> Django version 4.0.1, using settings 'project.settings'
>>> Starting development server at http://127.0.0.1:8000/
>>> Quit the server with CTRL-BREAK.
>>> [01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
>>> [01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143
>>>
>>> Please help me if you are expert on it.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/7034243a-72ba-47bb-a5a3-6c1bcdec67aan%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAJnMy6f18fkS2%2BMThaestycUN-NKGh2m3TV%2BpUH9ogkwX2Li_g%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAF7qQgA8POoZSH0_BtZ18Z-BhTh%2BYeFMAoCs%2BkXzcV0KDt3_fQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACoV%2BeFX1MrhDSf3OePf8MMfK-Fj2unGRz6dsgEw7gCOvvj%2BKA%40mail.gmail.com.


Re: Bad Request 400 in Django

2022-09-01 Thread Lakshyaraj Dash
What ??? It's September not july

On Thu, Sep 1, 2022, 22:29 subin  wrote:

> I will look forward to meeting you on July 11
>
> On Thu, Sep 1, 2022 at 4:14 PM Eric smith 
> wrote:
>
>> I have some issues in running django server.
>>
>> System check identified no issues (0 silenced).
>> September 01, 2022 - 10:58:47
>> Django version 4.0.1, using settings 'project.settings'
>> Starting development server at http://127.0.0.1:8000/
>> Quit the server with CTRL-BREAK.
>> [01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
>> [01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143
>>
>> Please help me if you are expert on it.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/7034243a-72ba-47bb-a5a3-6c1bcdec67aan%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJnMy6f18fkS2%2BMThaestycUN-NKGh2m3TV%2BpUH9ogkwX2Li_g%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF7qQgA8POoZSH0_BtZ18Z-BhTh%2BYeFMAoCs%2BkXzcV0KDt3_fQ%40mail.gmail.com.


Re: Bad Request 400 in Django

2022-09-01 Thread 'Kasper Laudrup' via Django users

On 01/09/2022 17.03, Eric smith wrote:

I have some issues in running django server.

System check identified no issues (0 silenced).
September 01, 2022 - 10:58:47
Django version 4.0.1, using settings 'project.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
[01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143

Please help me if you are expert on it.



HTTP 400 error means the client sent a request the server couldn't 
understand. What the client is, what it sent and why the server couldn't 
understand it, no expert is able to tell you. Only you can answer that.


Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52c013c6-f52b-8843-5727-95f520e4a712%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: Bad Request 400 in Django

2022-09-01 Thread subin
I will look forward to meeting you on July 11

On Thu, Sep 1, 2022 at 4:14 PM Eric smith  wrote:

> I have some issues in running django server.
>
> System check identified no issues (0 silenced).
> September 01, 2022 - 10:58:47
> Django version 4.0.1, using settings 'project.settings'
> Starting development server at http://127.0.0.1:8000/
> Quit the server with CTRL-BREAK.
> [01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
> [01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143
>
> Please help me if you are expert on it.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7034243a-72ba-47bb-a5a3-6c1bcdec67aan%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJnMy6f18fkS2%2BMThaestycUN-NKGh2m3TV%2BpUH9ogkwX2Li_g%40mail.gmail.com.


Re: Bad Request 400 in Django

2022-09-01 Thread subin
Hi

On Thu, Sep 1, 2022 at 4:25 PM Lipede Tope  wrote:

> Check your code
>
> On Thu, Sep 1, 2022, 4:13 PM Eric smith  wrote:
>
>> I have some issues in running django server.
>>
>> System check identified no issues (0 silenced).
>> September 01, 2022 - 10:58:47
>> Django version 4.0.1, using settings 'project.settings'
>> Starting development server at http://127.0.0.1:8000/
>> Quit the server with CTRL-BREAK.
>> [01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
>> [01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143
>>
>> Please help me if you are expert on it.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/7034243a-72ba-47bb-a5a3-6c1bcdec67aan%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABp6AaB2JzWBbSyFvNYPwDFn96bx2f%3DKT-ScUUgNNGuHVOYQpg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJnMy6fxSb5P9VdJrYMJLV5%3Dx6AJ%2B9K1YaJffOja1%3DXoUmxK2A%40mail.gmail.com.


Re: Bad Request 400 in Django

2022-09-01 Thread Lipede Tope
Check your code

On Thu, Sep 1, 2022, 4:13 PM Eric smith  wrote:

> I have some issues in running django server.
>
> System check identified no issues (0 silenced).
> September 01, 2022 - 10:58:47
> Django version 4.0.1, using settings 'project.settings'
> Starting development server at http://127.0.0.1:8000/
> Quit the server with CTRL-BREAK.
> [01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
> [01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143
>
> Please help me if you are expert on it.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7034243a-72ba-47bb-a5a3-6c1bcdec67aan%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABp6AaB2JzWBbSyFvNYPwDFn96bx2f%3DKT-ScUUgNNGuHVOYQpg%40mail.gmail.com.


Bad Request 400 in Django

2022-09-01 Thread Eric smith
I have some issues in running django server.

System check identified no issues (0 silenced).
September 01, 2022 - 10:58:47
Django version 4.0.1, using settings 'project.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
[01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143

Please help me if you are expert on it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7034243a-72ba-47bb-a5a3-6c1bcdec67aan%40googlegroups.com.


Re: Job Request As A Software Developer

2022-09-01 Thread R V Tulasi
My company recruting
Pls share cv to 9966342766 through whatsapp
Python developer vacancy

On Thu, Sep 1, 2022, 1:09 PM Onjomba Felix  wrote:

> Hae,
> I am humbly requesting if you have any job or referral to a job just tell
> me bellow is my Cover Letter and CV.
> [image: WhatsApp Image 2022-08-30 at 21.03.40.jpg]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJU16zc2C9BGiQaAEnrbUDLdXgL%2B4zFs%3DpJzfLJjKrsiD3BNDQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAMQv6Jh_iL3SjgXHmf3Lz0e4OFuiyFe_rdTAgXdPZ1RyWVv%2BQ%40mail.gmail.com.


Re: Job Request As A Software Developer

2022-09-01 Thread Kunal Solanke
I don't have any job openings in mind, but I'd suggest you make your CV
again.


1. Keep it 2 pages tops(this is important)
2. No need for about keep it in your linkdein
3. Create Education, Experience and projects and Achievements.
4. Include top 2-3 experiences and projects to make it shorters
5. Use some kind of resume template to make it look better


And lastly you can apply on jobs openings and amazon/databricks they have
intern openings I think.

Hope it helps


Regards


On Thu, Sep 1, 2022, 13:09 Onjomba Felix  wrote:

> Hae,
> I am humbly requesting if you have any job or referral to a job just tell
> me bellow is my Cover Letter and CV.
> [image: WhatsApp Image 2022-08-30 at 21.03.40.jpg]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJU16zc2C9BGiQaAEnrbUDLdXgL%2B4zFs%3DpJzfLJjKrsiD3BNDQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOecAnzLM-PUpBQgUt94_JwczJK2LZRAOrK3_pk2FQt7pLp4iQ%40mail.gmail.com.


Re: Bug Request!

2022-07-25 Thread Ryan Nowakowski
You'll definitely want to include the actual exceptions and warnings that are 
occurring in your bug report.

On July 25, 2022 9:05:53 AM CDT, Ken Booo  wrote:
>Here, I caught a one bug on Django-->4.0.6
>There is no argumented support and base_dir is having exemptions causing
>warnings![image: WhatsApp Image 2022-07-18 at 11.59.01 AM.jpeg]
>
>-- 
>You received this message because you are subscribed to the Google Groups 
>"Django users" group.
>To unsubscribe from this group and stop receiving emails from it, send an 
>email to django-users+unsubscr...@googlegroups.com.
>To view this discussion on the web visit 
>https://groups.google.com/d/msgid/django-users/CAGiSraCtPC2oHsXL2EDy%3DhXFFt_4bPDpHrFz0RR-UzJb0wZmRQ%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3482F39B-1437-4F43-829A-B970D1912180%40fattuba.com.


Bug Request!

2022-07-25 Thread Ken Booo
Here, I caught a one bug on Django-->4.0.6
There is no argumented support and base_dir is having exemptions causing
warnings![image: WhatsApp Image 2022-07-18 at 11.59.01 AM.jpeg]

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGiSraCtPC2oHsXL2EDy%3DhXFFt_4bPDpHrFz0RR-UzJb0wZmRQ%40mail.gmail.com.


Re: Does Django care about max_query_params? [feature request]

2022-07-05 Thread Jason
https://github.com/googleapis/python-spanner-django/pull/774

seems like an open PR is addressing this.



On Tuesday, July 5, 2022 at 6:13:32 AM UTC-4 gurov...@gmail.com wrote:

> It's Cloud Spanner. We're using `django_spanner` as a 3rd party connector: 
> https://github.com/googleapis/python-spanner-django
>
> On Tuesday, June 28, 2022 at 11:36:08 AM UTC+4 Jason wrote:
>
>>
>> What db are you using? This might also be an issue for your db connector 
>> lib 
>> On Monday, June 27, 2022 at 10:49:40 AM UTC-4 gurov...@gmail.com wrote:
>>
>>> Hi, all!
>>>
>>> Gotta problem with the number of query params. We're using a backend, 
>>> which connects to a cloud database, and at some point we suddenly started 
>>> getting such an error:
>>>
>>> *Number of parameters in query exceeds the maximum allowed limit of 950*
>>>
>>> Appearing on this step:
>>>
>>>
>>> *django/django/contrib/auth/management/__init__.py", line 83, in 
>>> create_permissionsPermission.objects.using(using).bulk_create(perms)*
>>>
>>> 950 query params is the max number for our backend, and we set the 
>>> *DatabaseFeatures.max_query_params 
>>> *to 900. Still, it looks like Django doesn't care.
>>>
>>> Because of this all of our tests stopped working, bringing a lot of 
>>> inconveniences during development. Seems to me that it should be fixed on 
>>> Django side, centralized, 'cause it's unlikely we're the only who met and 
>>> will meet the problem in future.
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7774a7ba-cef3-4b1a-95f3-a5759ad7ca50n%40googlegroups.com.


Re: Does Django care about max_query_params? [feature request]

2022-07-05 Thread Ilya Gurov
It's Cloud Spanner. We're using `django_spanner` as a 3rd party 
connector: https://github.com/googleapis/python-spanner-django

On Tuesday, June 28, 2022 at 11:36:08 AM UTC+4 Jason wrote:

>
> What db are you using? This might also be an issue for your db connector 
> lib 
> On Monday, June 27, 2022 at 10:49:40 AM UTC-4 gurov...@gmail.com wrote:
>
>> Hi, all!
>>
>> Gotta problem with the number of query params. We're using a backend, 
>> which connects to a cloud database, and at some point we suddenly started 
>> getting such an error:
>>
>> *Number of parameters in query exceeds the maximum allowed limit of 950*
>>
>> Appearing on this step:
>>
>>
>> *django/django/contrib/auth/management/__init__.py", line 83, in 
>> create_permissionsPermission.objects.using(using).bulk_create(perms)*
>>
>> 950 query params is the max number for our backend, and we set the 
>> *DatabaseFeatures.max_query_params 
>> *to 900. Still, it looks like Django doesn't care.
>>
>> Because of this all of our tests stopped working, bringing a lot of 
>> inconveniences during development. Seems to me that it should be fixed on 
>> Django side, centralized, 'cause it's unlikely we're the only who met and 
>> will meet the problem in future.
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/306a4ef7-3a94-488f-bc7e-b505f44e4e32n%40googlegroups.com.


Re: Does Django care about max_query_params? [feature request]

2022-06-28 Thread Jason

What db are you using? This might also be an issue for your db connector 
lib 
On Monday, June 27, 2022 at 10:49:40 AM UTC-4 gurov...@gmail.com wrote:

> Hi, all!
>
> Gotta problem with the number of query params. We're using a backend, 
> which connects to a cloud database, and at some point we suddenly started 
> getting such an error:
>
> *Number of parameters in query exceeds the maximum allowed limit of 950*
>
> Appearing on this step:
>
>
> *django/django/contrib/auth/management/__init__.py", line 83, in 
> create_permissionsPermission.objects.using(using).bulk_create(perms)*
>
> 950 query params is the max number for our backend, and we set the 
> *DatabaseFeatures.max_query_params 
> *to 900. Still, it looks like Django doesn't care.
>
> Because of this all of our tests stopped working, bringing a lot of 
> inconveniences during development. Seems to me that it should be fixed on 
> Django side, centralized, 'cause it's unlikely we're the only who met and 
> will meet the problem in future.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9c877978-70df-4452-b05d-63b98f551de3n%40googlegroups.com.


Does Django care about max_query_params? [feature request]

2022-06-27 Thread Ilya Gurov
Hi, all!

Gotta problem with the number of query params. We're using a backend, which 
connects to a cloud database, and at some point we suddenly started getting 
such an error:

*Number of parameters in query exceeds the maximum allowed limit of 950*

Appearing on this step:


*django/django/contrib/auth/management/__init__.py", line 83, in 
create_permissionsPermission.objects.using(using).bulk_create(perms)*

950 query params is the max number for our backend, and we set the 
*DatabaseFeatures.max_query_params 
*to 900. Still, it looks like Django doesn't care.

Because of this all of our tests stopped working, bringing a lot of 
inconveniences during development. Seems to me that it should be fixed on 
Django side, centralized, 'cause it's unlikely we're the only who met and 
will meet the problem in future.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9a1a3b9c-62a1-496d-ab7e-b12cb5560994n%40googlegroups.com.


hello everyone please can someone help me with my problem is very important please Environment: Request Method: GET Request URL: http://127.0.0.1:8000/user/ Django Version: 4.0.4 Python Version: 3

2022-04-30 Thread ray nkamwa
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/afc98569-1c64-4322-a533-d62a1a297115n%40googlegroups.com.
Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/user/

Django Version: 4.0.4
Python Version: 3.10.4
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'djangopressing',
 'bdpressing',
 'rest_framework',
 'django_filters',
 'rest_framework.authtoken',
 'dj_rest_auth']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback (most recent call last):
  File 
"C:\Users\User\Desktop\djangopressing\env\lib\site-packages\django\core\handlers\exception.py",
 line 55, in inner
response = get_response(request)
  File 
"C:\Users\User\Desktop\djangopressing\env\lib\site-packages\django\core\handlers\base.py",
 line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File 
"C:\Users\User\Desktop\djangopressing\env\lib\site-packages\django\views\decorators\csrf.py",
 line 54, in wrapped_view
return view_func(*args, **kwargs)
  File 
"C:\Users\User\Desktop\djangopressing\env\lib\site-packages\rest_framework\viewsets.py",
 line 125, in view
return self.dispatch(request, *args, **kwargs)
  File 
"C:\Users\User\Desktop\djangopressing\env\lib\site-packages\rest_framework\views.py",
 line 509, in dispatch
response = self.handle_exception(exc)
  File 
"C:\Users\User\Desktop\djangopressing\env\lib\site-packages\rest_framework\views.py",
 line 469, in handle_exception
self.raise_uncaught_exception(exc)
  File 
"C:\Users\User\Desktop\djangopressing\env\lib\site-packages\rest_framework\views.py",
 line 480, in raise_uncaught_exception
raise exc
  File 
"C:\Users\User\Desktop\djangopressing\env\lib\site-packages\rest_framework\views.py",
 line 497, in dispatch
self.initial(request, *args, **kwargs)
  File 
"C:\Users\User\Desktop\djangopressing\env\lib\site-packages\rest_framework\views.py",
 line 415, in initial
self.check_permissions(request)
  File 
"C:\Users\User\Desktop\djangopressing\env\lib\site-packages\rest_framework\views.py",
 line 331, in check_permissions
for permission in self.get_permissions():
  File 
"C:\Users\User\Desktop\djangopressing\env\lib\site-packages\rest_framework\views.py",
 line 278, in get_permissions
return [permission() for permission in self.permission_classes]

Exception Type: TypeError at /user/
Exception Value: 'BasePermissionMetaclass' object is not iterable

Re: request.POST.getlist('xxx') only has one value in ajax request for many2many

2022-01-17 Thread Julio Cojom
I remember having a problem like that once, in your views print the hole
dictionary "print(request.POST)", you should see all the values of the
field you want as list, not just one.

Then instead of getlist try just get, request.POST.get('field_here')

Let me know how it goes

El lun., 17 de enero de 2022 11:52 a. m., Campbell McKilligan <
campb...@dxclabs.com> escribió:

> Yeah - I am looping.  I just get one iteration which is the last item even
> though the request body has the same key repeated.
>
> For example, this code only prints one item, whereas for a different form
> elsewhere, it would iterate through all the identical keys:
>print(self.request.__dict__)
>   for pool in self.request.POST.getlist('pool_list'):
>   print(f"form pool_list item: {pool}")
>
> The main difference to when it works is that this form is submitted via
> ajax; and uses UpdateView.
>
> On Monday, 17 January 2022 at 01:34:18 UTC Jason wrote:
>
>> https://code.djangoproject.com/ticket/1130
>>
>> Essentially, this is expected behavior, and previous comment is correct.
>> Need to loop through the items in the list
>>
>> On Sunday, January 16, 2022 at 5:42:45 PM UTC-5 richy...@gmail.com wrote:
>>
>>> You might want to loop through the list
>>> Example:
>>> Lists = request.getlist('item')
>>> For list in Lists:
>>> .
>>>
>>>
>>> On Sun, Jan 16, 2022, 9:30 PM Campbell McKilligan 
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> Using Django 3.2 and Py 3.9
>>>>
>>>> I have an ajax request which submits multiple values for a field to an
>>>> UpdateView.
>>>>
>>>> In the request dict body I see both values (in this case, for the
>>>> pool_list column):
>>>>
>>>> '_body':
>>>> b"csrfmiddlewaretoken=z...h&...&key=...&expiry_datetime=&overflow=555&
>>>> *pool_list=507&pool_list=499*&...
>>>>
>>>> Later in the request dict, I only see one of the values in the _post:
>>>> '_post': * 'pool_list': ['499'],*
>>>>
>>>> This means that in request.POST.getlist('pool_list'), I'm only getting
>>>> one result in the list object.
>>>>
>>>> Any idea why it's only the last value being populated in the getlist?
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/bf3a5e3b-4e8c-4a73-8647-d494bedbdf90n%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/bf3a5e3b-4e8c-4a73-8647-d494bedbdf90n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6fc15142-4650-4bac-a3f9-efd411f3813an%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/6fc15142-4650-4bac-a3f9-efd411f3813an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHRQUHmdG15CO6b7hh5JFyGLZytm11wPsQC-j-V_jRqpakaywA%40mail.gmail.com.


Re: request.POST.getlist('xxx') only has one value in ajax request for many2many

2022-01-17 Thread Campbell McKilligan
Yeah - I am looping.  I just get one iteration which is the last item even 
though the request body has the same key repeated.

For example, this code only prints one item, whereas for a different form 
elsewhere, it would iterate through all the identical keys:
   print(self.request.__dict__)
  for pool in self.request.POST.getlist('pool_list'):
  print(f"form pool_list item: {pool}")

The main difference to when it works is that this form is submitted via 
ajax; and uses UpdateView. 

On Monday, 17 January 2022 at 01:34:18 UTC Jason wrote:

> https://code.djangoproject.com/ticket/1130
>
> Essentially, this is expected behavior, and previous comment is correct.  
> Need to loop through the items in the list
>
> On Sunday, January 16, 2022 at 5:42:45 PM UTC-5 richy...@gmail.com wrote:
>
>> You might want to loop through the list 
>> Example:
>> Lists = request.getlist('item')
>> For list in Lists:
>> .
>>
>>
>> On Sun, Jan 16, 2022, 9:30 PM Campbell McKilligan  
>> wrote:
>>
>>> Hi,
>>>
>>> Using Django 3.2 and Py 3.9
>>>
>>> I have an ajax request which submits multiple values for a field to an 
>>> UpdateView.
>>>
>>> In the request dict body I see both values (in this case, for the 
>>> pool_list column):
>>>
>>> '_body': 
>>> b"csrfmiddlewaretoken=z...h&...&key=...&expiry_datetime=&overflow=555&
>>> *pool_list=507&pool_list=499*&...
>>>
>>> Later in the request dict, I only see one of the values in the _post:
>>> '_post': * 'pool_list': ['499'],*
>>>
>>> This means that in request.POST.getlist('pool_list'), I'm only getting 
>>> one result in the list object.
>>>
>>> Any idea why it's only the last value being populated in the getlist?
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/bf3a5e3b-4e8c-4a73-8647-d494bedbdf90n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/bf3a5e3b-4e8c-4a73-8647-d494bedbdf90n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6fc15142-4650-4bac-a3f9-efd411f3813an%40googlegroups.com.


Re: ModelMultipleChoiceField - different number of values in request _body and _post

2022-01-17 Thread Campbell McKilligan
F%2Fwww.facebook.com%2Fdxclabs%22+target%3D%22_blank%22+title%3D%22Seoul+Environment+Expo+2022+on+Facebook%22%3E%0ASeoul+Environment+Expo+2022%0A%3C%2Fa%3E%0A%3C%2Fp%3E%0A%0A%0A%0A%3Cp%3EInstagram%3A%0A%3Ca+href%3D%22https%3A%2F%2Fwww.instagram.com%2Fdxclabs%2F%22+target%3D%22_blank%22+title%3D%22Seoul+Environment+Expo+2022+on+Instagram%22%3E%0ASeoul+Environment+Expo+2022%0A%3C%2Fa%3E%0A%3C%2Fp%3E%0A%0A%0A%0A%3Cp%3ETwitter%3A%0A%3Ca+href%3D%22https%3A%2F%2Ftwitter.com%2Fdxclabs%22+target%3D%22_blank%22+title%3D%22Seoul+Environment+Expo+2022+on+Twitter%22%3E%0ASeoul+Environment+Expo+2022%0A%3C%2Fa%3E%0A%3C%2Fp%3E%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%3Ch2%3EMore+Information%3C%2Fh2%3E%0ACheck+out+our+FAQ+section+here%3A%0A%3Ca+href%3D%22https%3A%2F%2Fdxclabs.com%2Ffaqs%2F%22%3EShowoff!+FAQs%3C%2Fa%3E%0A%3Ch2%3ECan't+find+what+you're+looking+for%3F%3C%2Fh2%3E%0A%3Cp%3EGive+us+a+call+at%3A+555+%3C%2Fp%3E%0A%3Cp%3EEmail+us+at%3A+%3Ca+href%3D%22mailto%3Ahello%40dxclabs.com%22%3Ehello%40dxclabs.com%3C%2Fa%3E%3C%2Fp%3E&overflow_text=%3Ch2%3ESign-up+for+Seoul+Environment+Expo+2022+is+full!%3C%2Fh2%3E%0A%3Cp%3EWe+have+had+a+great+response+from+people+for+participation!%3C%2Fp%3E%0A%3Cp%3EAs+we+are+full%2C+we've+put+you+in+a+wait+list.%3C%2Fp%3E%0A%3Cp%3EPlaces+do+become+available+now-and-then+and+we'll+let+you+know+as+soon+as+we+know+about+any+new+places.%3C%2Fp%3E%0A%3Ch2%3EOther+ways+to+be+involved%3A%3C%2Fh2%3E%0A%3Cp%3EBe+a+volunteer%3C%2Fp%3E%0A%3Cp%3ECome+and+watch%3C%2Fp%3E%0A%3Ch2%3EHow+can+we+watch%3F%3C%2Fh2%3E%0ATicket+sales+are+available+via+our+ticketing+partner%3A%0A%3Cb%3E%3Cu%3EEvent+Tix%3C%2Fu%3E%3C%2Fb%3E%0A%0A%0A%0A%0A%3Ch2%3EFollow+Us!%3C%2Fh2%3E%0A%0A%0A%3Cp%3EFacebook%3A%0A%3Ca+href%3D%22https%3A%2F%2Fwww.facebook.com%2Fdxclabs%22+target%3D%22_blank%22+title%3D%22Seoul+Environment+Expo+2022+on+Facebook%22%3E%0ASeoul+Environment+Expo+2022%0A%3C%2Fa%3E%0A%3C%2Fp%3E%0A%0A%0A%0A%3Cp%3EInstagram%3A%0A%3Ca+href%3D%22https%3A%2F%2Fwww.instagram.com%2Fdxclabs%2F%22+target%3D%22_blank%22+title%3D%22Seoul+Environment+Expo+2022+on+Instagram%22%3E%0ASeoul+Environment+Expo+2022%0A%3C%2Fa%3E%0A%3C%2Fp%3E%0A%0A%0A%0A%3Cp%3ETwitter%3A%0A%3Ca+href%3D%22https%3A%2F%2Ftwitter.com%2Fdxclabs%22+target%3D%22_blank%22+title%3D%22Seoul+Environment+Expo+2022+on+Twitter%22%3E%0ASeoul+Environment+Expo+2022%0A%3C%2Fa%3E%0A%3C%2Fp%3E%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%3Ch2%3EMore+Information%3C%2Fh2%3E%0ACheck+out+our+FAQ+section+here%3A%0A%3Ca+href%3D%22https%3A%2F%2Fdxclabs.com%2Ffaqs%2F%22%3EShowoff!+FAQs%3C%2Fa%3E%0A%3Ch2%3ECan't+find+what+you're+looking+for%3F%3C%2Fh2%3E%0A%3Cp%3EGive+us+a+call+at%3A+555+%3C%2Fp%3E%0A%3Cp%3EEmail+us+at%3A+%3Ca+href%3D%22mailto%3Ahello%40dxclabs.com%22%3Ehello%40dxclabs.com%3C%2Fa%3E%3C%2Fp%3E
On Monday, 17 January 2022 at 05:22:01 UTC chau...@gmail.com wrote:

> Information for your post request is missing. Paste all the data that is 
> sent when making a post request. That way everyone gets the idea of what 
> you are trying to achieve.
>
> On Sun, Jan 16, 2022, 10:22 PM Campbell McKilligan  
> wrote:
>
>> Hi,
>> I have an ajax request which submits multiple values to an UpdateView.
>>
>> In the request dict body I see both values (in this case, for the 
>> pool_list column):
>>
>> '_body': 
>> b"csrfmiddlewaretoken=z...h&...&key=...&expiry_datetime=&overflow=555&
>> *pool_list=507&pool_list=499*&...
>>
>> Later in the request dict, I only see one of the values in the _post:
>> '_post': * 'pool_list': ['499'],*
>>
>> This means that in request.POST.getlist('pool_list'), I'm only getting 
>> one result in the list object.
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/f2f7a4f2-26bd-46b3-88f2-532b5137124en%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/f2f7a4f2-26bd-46b3-88f2-532b5137124en%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8142eebf-017a-47f1-ba2f-0fd41f87e1a4n%40googlegroups.com.


Re: ModelMultipleChoiceField - different number of values in request _body and _post

2022-01-16 Thread Patrice Chaula
Information for your post request is missing. Paste all the data that is
sent when making a post request. That way everyone gets the idea of what
you are trying to achieve.

On Sun, Jan 16, 2022, 10:22 PM Campbell McKilligan 
wrote:

> Hi,
> I have an ajax request which submits multiple values to an UpdateView.
>
> In the request dict body I see both values (in this case, for the
> pool_list column):
>
> '_body':
> b"csrfmiddlewaretoken=z...h&...&key=...&expiry_datetime=&overflow=555&
> *pool_list=507&pool_list=499*&...
>
> Later in the request dict, I only see one of the values in the _post:
> '_post': * 'pool_list': ['499'],*
>
> This means that in request.POST.getlist('pool_list'), I'm only getting one
> result in the list object.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f2f7a4f2-26bd-46b3-88f2-532b5137124en%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f2f7a4f2-26bd-46b3-88f2-532b5137124en%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE%3DG6DYU65YPPjAx0NwaKvR%2B0X_B8KYE5Jr1U1E3rqPqWdS4Uw%40mail.gmail.com.


Re: request.POST.getlist('xxx') only has one value in ajax request for many2many

2022-01-16 Thread Jason
https://code.djangoproject.com/ticket/1130

Essentially, this is expected behavior, and previous comment is correct.  
Need to loop through the items in the list

On Sunday, January 16, 2022 at 5:42:45 PM UTC-5 richy...@gmail.com wrote:

> You might want to loop through the list 
> Example:
> Lists = request.getlist('item')
> For list in Lists:
> .
>
>
> On Sun, Jan 16, 2022, 9:30 PM Campbell McKilligan  
> wrote:
>
>> Hi,
>>
>> Using Django 3.2 and Py 3.9
>>
>> I have an ajax request which submits multiple values for a field to an 
>> UpdateView.
>>
>> In the request dict body I see both values (in this case, for the 
>> pool_list column):
>>
>> '_body': 
>> b"csrfmiddlewaretoken=z...h&...&key=...&expiry_datetime=&overflow=555&
>> *pool_list=507&pool_list=499*&...
>>
>> Later in the request dict, I only see one of the values in the _post:
>> '_post': * 'pool_list': ['499'],*
>>
>> This means that in request.POST.getlist('pool_list'), I'm only getting 
>> one result in the list object.
>>
>> Any idea why it's only the last value being populated in the getlist?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/bf3a5e3b-4e8c-4a73-8647-d494bedbdf90n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/bf3a5e3b-4e8c-4a73-8647-d494bedbdf90n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cfbd6e3f-4587-4aab-b751-8ae85a6f3479n%40googlegroups.com.


Re: request.POST.getlist('xxx') only has one value in ajax request for many2many

2022-01-16 Thread Odigiri Richard
You might want to loop through the list
Example:
Lists = request.getlist('item')
For list in Lists:
.


On Sun, Jan 16, 2022, 9:30 PM Campbell McKilligan 
wrote:

> Hi,
>
> Using Django 3.2 and Py 3.9
>
> I have an ajax request which submits multiple values for a field to an
> UpdateView.
>
> In the request dict body I see both values (in this case, for the
> pool_list column):
>
> '_body':
> b"csrfmiddlewaretoken=z...h&...&key=...&expiry_datetime=&overflow=555&
> *pool_list=507&pool_list=499*&...
>
> Later in the request dict, I only see one of the values in the _post:
> '_post': * 'pool_list': ['499'],*
>
> This means that in request.POST.getlist('pool_list'), I'm only getting
> one result in the list object.
>
> Any idea why it's only the last value being populated in the getlist?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bf3a5e3b-4e8c-4a73-8647-d494bedbdf90n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/bf3a5e3b-4e8c-4a73-8647-d494bedbdf90n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B3Gu_NzgLrNW7PK-LVzCkE9U6BLctrrFDba88KfKFTwzi60%2Bg%40mail.gmail.com.


request.POST.getlist('xxx') only has one value in ajax request for many2many

2022-01-16 Thread Campbell McKilligan
Hi,

Using Django 3.2 and Py 3.9

I have an ajax request which submits multiple values for a field to an 
UpdateView.

In the request dict body I see both values (in this case, for the pool_list 
column):

'_body': 
b"csrfmiddlewaretoken=z...h&...&key=...&expiry_datetime=&overflow=555&
*pool_list=507&pool_list=499*&...

Later in the request dict, I only see one of the values in the _post:
'_post': * 'pool_list': ['499'],*

This means that in request.POST.getlist('pool_list'), I'm only getting one 
result in the list object.

Any idea why it's only the last value being populated in the getlist?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bf3a5e3b-4e8c-4a73-8647-d494bedbdf90n%40googlegroups.com.


ModelMultipleChoiceField - different number of values in request _body and _post

2022-01-16 Thread Campbell McKilligan
Hi,
I have an ajax request which submits multiple values to an UpdateView.

In the request dict body I see both values (in this case, for the pool_list 
column):

'_body': 
b"csrfmiddlewaretoken=z...h&...&key=...&expiry_datetime=&overflow=555&
*pool_list=507&pool_list=499*&...

Later in the request dict, I only see one of the values in the _post:
'_post': * 'pool_list': ['499'],*

This means that in request.POST.getlist('pool_list'), I'm only getting one 
result in the list object.



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f2f7a4f2-26bd-46b3-88f2-532b5137124en%40googlegroups.com.


Re: Eliminating inter-request race conditions

2022-01-08 Thread Nick Farrell
I thought I'd post a little update, as I'm fairly happy with my progress:

Here's the repo's readme. I haven't actually pushed the package to pypi so 
don't try to follow the instructions yet, but any feedback on the README's 
content is very welcome: 
https://github.com/nicois/nango/blob/develop/README.md . Hopefully in the 
next couple of days I'll push the package to pypi so anyone who's 
interested can make sure it works as advertised.

But still I wonder if client-side validation and feedback should be 
> optional? That is, if I had to do this myself, I'd hope to find a solution 
> first that works 100 % without client-side effects. This would also help a 
> lot with correctness and testing. Then I'd put all eye candy on top, but 
> keeping it strictly optional.


The client-side validation is latent in this release. That is, there is 
some code which will provide client-side validation with websockets, but it 
is disabled unless explicitly enabled in settings.py. I've put in the 
beginnings of some automated tests, which I can expand as I proceed. I 
agree that the server-side data integrity is more important, lower risk and 
easier to test.
 

> > There are only two ways I can see of to achieve this: use a full-blown 
> "rowversion" CAS pattern, where there is a dedicated monotonic column on 
> each table which automatically increases with each update, or the method I 
> propose/use, where the original form values are provided via the user agent 
> when the form is POSTed. 
>
> Then this would have to be temper-proof, wouldn't it? 
> (e.g. using https://itsdangerous.palletsprojects.com )

No, the (current) intention is not to make this tamper-proof. If you think 
about it, there is no value from trying to protect against an authenticated 
and authorised user who wants to submit incorrect values. While there could 
be HMACs etc, I don't see any value at all, as a malicious user does not 
need to tamper with the original values to submit bad data.
 

> It might even be possible to serialize the entire state of the object into 
> a single hidden field and sign it on GET, then check the signature and 
> deserialize on POST. Or maybe, depending on the exact requirements, even 
> the checksum of the old state would be enough in order to detect that 
> something changed between the old version of the model (as it was when the 
> user started editing it) and the current version (at the time the POST 
> request arrives). This would roughly correspond to a version number without 
> requiring an explicit field on the model.
>
Remember also that there is little to no value in checking that fields on 
the model have changed, if those fields are not shown on the model: firstly 
because the form will not update those fields in the database, and secondly 
because if only those "invisible" fields change, the end-user would see the 
same thing on the form, and would not alter their behaviour. 

The value here is in showing a user that one of the fields they are in the 
process of editing has changed while they have had the form open, and 
ensuring that they do not accidentally clobber someone else's changes.

Thanks for your feedback so far. 
 
Nick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a449bb5f-c834-457e-83f5-02eec2e0e784n%40googlegroups.com.


Request result update only if I change even one character... Strange... :s

2022-01-08 Thread Sébastien Denooz
Hello to all of you,

I have a very strange behavior that I do not understand and that I will try 
to explain here:

*Global situation:* School management website.

*Expected comportment:* User show student amout: 10. User Add 5, return to 
app, pull down to refresh and see 15.

*Actual comportment:* User show student amout: 10. User Add 5, return to 
app, pull down to refresh and see 10.

*Fix:* I change only on char in my code (even a space, a letter, a tab or 
anything else), the manage.py runserver reload, i pull down to refresh and 
see 15.

If i put the code of the function that calculate the total amount direct in 
the method user in the request, all is good. :/

Totaly incomprehensible :s

*Details:*
- I have 2 applications: One manages students, another manages payments for 
them.
- In my payment model, I have this function :
class Payment(SoftDeleteObject, models.Model):
amount = models.FloatField()
...

@staticmethod
def get_total_payments(wallet_reference=False, 
date=timezone.datetime.now()):
""""
Get total payment from wallet reference and from a date
@param wallet_reference:
@param date:
@return:
"""
payments = Payment.objects.filter(
Q(wallet_reference=wallet_reference),
Q(payment_date__lte=date),
Q(status=PAYMENT_STATUS['SUCCEEDED'])
)
total_payment = 0
for payment in payments:
total_payment += payment.amount
return total_payment

- In my payment application, I use this function when I make a request to 
find the total available, the total consumed, etc... like this:

class ListStudentPayment(generics.GenericAPIView):

def get(self, *args, **kwargs):
today = timezone.now().date()
student = Student.objects.get(pk=kwargs['student_id'])
    
total_payment = Payment.get_total_payments(student.wallet_reference)

- This function is called right after a stripe payment, to refresh my 
student's balance in the application.

Do you have an explaination ?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3c7bcb96-cb00-48bb-9206-0ac1bcaa960cn%40googlegroups.com.


Re: Eliminating inter-request race conditions

2021-12-31 Thread Carsten Fuchs
Hello,

Am 31.12.21 um 11:31 schrieb Nick Farrell:
> Correct. To be clear, I am not advocating this behaviour by default, but 
> making it as seamless as possible to enable when required, rather than 
> needing to attempt to hand-roll safe locking semantics each time it's needed.

Thanks for the clarification! It just confused me a bit because this approach 
seems to be complementary (or even barely related) to the other aspects.

> Certainly there is increased complexity. For the websites I am involved in 
> (primarily health-related ones), if I don't end up providing a django-based 
> solution, product owners end up demanding a SPA-based solution or similar, 
> with the even-greater complexity to the development stack, not to mention 
> testing. 

Ahh, a very good point!  :-)
But still I wonder if client-side validation and feedback should be optional? 
That is, if I had to do this myself, I'd hope to find a solution first that 
works 100 % without client-side effects. This would also help a lot with 
correctness and testing. Then I'd put all eye candy on top, but keeping it 
strictly optional.

> if request.method == 'POST':
> form = SomeForm(request.POST, initial=init)
> ...
> 
> Note the `initial` parameter: It is used just as it is in the GET 
> request. This allows you to use `form.changed_data` and `form.has_changed()` 
> in form validation.
> 
> But where does "init" come from? How can you know what version of the model 
> instance was shown to the user when the form was rendered?

Hmmm. Yes, I see your point...

> There are only two ways I can see of to achieve this: use a full-blown 
> "rowversion" CAS pattern, where there is a dedicated monotonic column on each 
> table which automatically increases with each update, or the method I 
> propose/use, where the original form values are provided via the user agent 
> when the form is POSTed.

Then this would have to be temper-proof, wouldn't it?
(e.g. using https://itsdangerous.palletsprojects.com )

It might even be possible to serialize the entire state of the object into a 
single hidden field and sign it on GET, then check the signature and 
deserialize on POST. Or maybe, depending on the exact requirements, even the 
checksum of the old state would be enough in order to detect that something 
changed between the old version of the model (as it was when the user started 
editing it) and the current version (at the time the POST request arrives). 
This would roughly correspond to a version number without requiring an explicit 
field on the model.

> Gute Rutsch.

Danke gleichfalls!  :-)
Thanks, the same to you!

Best regards,
Carsten

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e42bba72-f122-6223-c517-75a8f74bf222%40cafu.de.


Re: Eliminating inter-request race conditions

2021-12-31 Thread Nick Farrell
Good to hear from you Carsten. Thanks in advance for your comments. I'll 
see what I can address now:

>
> > *2)* Not being able to safely lock a model/queryset beyond the lifetime 
> of the request. 
>
I don't quite understand this. It sounds like pessimistic locking?

Correct. To be clear, I am not advocating this behaviour by default, but 
making it as seamless as possible to enable when required, rather than 
needing to attempt to hand-roll safe locking semantics each time it's 
needed.
 

> > *3)* Not knowing that data has changed on the server until you submit a 
> form. 
> > *4)* Smarter form validation 
>
> Well, this comes at the cost of the complexity to implement this. For me, 
> at least at this time, the cost is much to high to consider this.
>
Certainly there is increased complexity. For the websites I am involved in 
(primarily health-related ones), if I don't end up providing a django-based 
solution, product owners end up demanding a SPA-based solution or similar, 
with the even-greater complexity to the development stack, not to mention 
testing. 

 

> > *The solutions* 
> > 
> > *Enhanced forms* 
> > - when rendering a form (using e.g. as_p()), alongside the normal INPUT 
> DOM elements, include additional hidden fields which store a copy of each 
> form field's initial value. 
>
> I don't think that having hidden fields with the initial values is 
> necessary: In your view, you can initialize the form like this: 
>
> if request.method == 'POST': 
> form = SomeForm(request.POST, initial=init) 
> ... 
>
> Note the `initial` parameter: It is used just as it is in the GET request. 
> This allows you to use `form.changed_data` and `form.has_changed()` in form 
> validation.

But where does "init" come from? How can you know what version of the model 
instance was shown to the user when the form was rendered? There are only 
two ways I can see of to achieve this: use a full-blown "rowversion" CAS 
pattern, where there is a dedicated monotonic column on each table which 
automatically increases with each update, or the method I propose/use, 
where the original form values are provided via the user agent when the 
form is POSTed. I guess a third option would be to cache the form values 
server-side using redis each time a form a served, and provide an ID to it, 
perhaps even using the CSRF token as the key.

Perhaps I am missing something - if there is a way to retrieve the initial 
value of the form automatically, I would love to use it.

Regarding formsets, the same applies, I agree it needs to support that, and 
by embedding the original values into each form in the formset, it should 
correctly respect those values when the formset is submitted. 

If it's of any assistance, I can push some code and provide some examples 
for you to try out. The same app I am using now should be quite easy to 
clone and evaluate. 

>
> Best regards, 
> Carsten

 
Gute Rutsch.

Nick 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cafc7989-44de-4035-88d1-c9d010946ed3n%40googlegroups.com.


Re: Eliminating inter-request race conditions

2021-12-31 Thread Carsten Fuchs
Hi Nick,

I've thought a bit more about this, but it seems that my requirements are 
different from yours: E.g. I don't need the client-side validation and 
especially don't want the complexity that goes with it; on the other hand, I 
need something that also works with formsets, not only with individual forms.

Am 27.12.21 um 06:36 schrieb Nick Farrell:
> *The problems *(from highest to lowest priority)*:*
> [...]
> *2)* Not being able to safely lock a model/queryset beyond the lifetime of 
> the request.

I don't quite understand this. It sounds like pessimistic locking?

> *3)* Not knowing that data has changed on the server until you submit a form.
> *4)* Smarter form validation

Well, this comes at the cost of the complexity to implement this. For me, at 
least at this time, the cost is much to high to consider this.

> *The solutions*
> 
> *Enhanced forms*
> - when rendering a form (using e.g. as_p()), alongside the normal INPUT DOM 
> elements, include additional hidden fields which store a copy of each form 
> field's initial value. 

I don't think that having hidden fields with the initial values is necessary: 
In your view, you can initialize the form like this:

if request.method == 'POST':
form = SomeForm(request.POST, initial=init)
...

Note the `initial` parameter: It is used just as it is in the GET request. This 
allows you to use `form.changed_data` and `form.has_changed()` in form 
validation.

Note that the above, i.e. reconstructing the initial values also for POST 
requests, is useful both for individual forms and even more with multiple 
forms, i.e. formsets: If for example you edit a list (formset) of appointments, 
in formset validation you must make sure that the list of appointments has not 
changed in the meantime (e.g. appointments were not inserted, replaced or 
deleted).

Best regards,
Carsten

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7236dee6-010d-8d7e-df6c-4c1007043bdc%40cafu.de.


Re: Eliminating inter-request race conditions

2021-12-28 Thread Nick Farrell
Thanks for the reference Carsten.

I believe the approach I am taking, regarding optimistic locking, is 
superior to what is proposed in that thread. Specifically:
- there is no need for a special version field to be added to the model
- because forms only update specific fields in the associated model(s), 
there is no point in unnecessarily invalidating the form submission if 
unrelated model fields have been changed in the background; if a form does 
not show a field to begin with, having its value change would not alter the 
behaviour a person would make when editing the form.

Really I think this should be a code part of Django: just as you include 
CSRF protection virtually everywhere, you would be doing this. It is very 
rare that this feature would be undesired, and many Django developers will 
be getting burnt by the lack of CAS-like behaviour.

I'll continue to tinker with this either way, if only to use internally, if 
there isn't general interest.

cheers,

Nick.
On Tuesday, 28 December 2021 at 21:35:09 UTC+11 carste...@cafu.de wrote:

> Hi Nick,
>
> maybe this is a case for optimistic locking?
> Does the thread at 
> https://groups.google.com/d/msg/django-users/R7wJBTlC8ZM/MIzvYkWyCwAJ 
> help?
>
> Best regards,
> Carsten
>
>
> Am 27.12.21 um 06:36 schrieb Nick Farrell:
> > Hi all.
> > 
> > I've been using Django for quite a number of years now, in various ways. 
> Most of the time, I find myself needing to create custom solutions to solve 
> what appears to be a very common problem. 
> > 
> > During the Christmas downtime, I decided to scratch this itch, and am 
> putting together what will hopefully turn into a solution to what I'll 
> describe below. I'm writing this here to get a sense of what the Django 
> community sees in this: is this a niche problem, is it shared by a few 
> others, or is the lack of these features a fundamental overnight in the 
> core Django product?
> > 
> > *The problems *(from highest to lowest priority)*:*
> > *
> > *
> > *1)* a form is rendered, the data is changed by a different 
> task/request, then the form is submitted, overwriting the recent changes.
> > 
> > Whenever models can be modified by multiple users (or even the same user 
> in different windows/tabs of their browser), this can happen. Also, if 
> there are any background processes which can modify the data (e.g. celery, 
> or various data synchronisation services), it's possible.
> > In some situations this is no big deal, as the users do not really care, 
> or you know that the latest data would overwrite the previous data anyway. 
> But in general, this is a major risk, particularly when dealing with any 
> health or financial data. 
> > 
> > *2)* Not being able to safely lock a model/queryset beyond the lifetime 
> of the request.
> > 
> > This is related to problem 1, and solving problem 2 may in some 
> circumstances solve problem 1 - but not always. For example, depending on 
> how the lock is implemented, a "rogue" task/request may bypass the locking 
> mechanism and force a change to the underlying data. Also, if a lock is 
> based on a session, a user may have multiple tabs open in the same browser, 
> using the same session state (via shared cookies)
> > 
> > Solving this problem will reduce the chance that when a person does post 
> a form update, that there is any conflict, meaning fewer tears.
> > 
> > *3)* Not knowing that data has changed on the server until you submit a 
> form.
> > 
> > Ideally there would be a means for someone viewing/editing a form to 
> immediately be notified if data changes on the server, obsoleting the 
> current form. This reduces the amount of wasted time is spent completing a 
> form which is already known to be out of sync, and will need to be redone 
> anyway (as long as problem 1 is solved; otherwise, there'll be data loss)
> > 
> > *4)* Smarter form validation
> > 
> > There are three types of missing validation: 
> > - the first is that the default widgets do not support even very simple 
> client-side validation. For example, a text field might need to match a 
> regular expression. 
> > - the second type is an ability to provide (in the model definition) 
> arbitrary javascript which can be executed client-side to provide richer 
> realtime validation during data entry.
> > - the third type involves effectively providing provisional form data to 
> the server, and having Django validate() the form content without actually 
> saving the result. This would allow (for example) inter-field dependencies 
> to be evaluated without any custom code, providing near-realtime feedback 
> to 

Re: Eliminating inter-request race conditions

2021-12-28 Thread Carsten Fuchs
Hi Nick,

maybe this is a case for optimistic locking?
Does the thread at 
https://groups.google.com/d/msg/django-users/R7wJBTlC8ZM/MIzvYkWyCwAJ help?

Best regards,
Carsten


Am 27.12.21 um 06:36 schrieb Nick Farrell:
> Hi all.
> 
> I've been using Django for quite a number of years now, in various ways. Most 
> of the time, I find myself needing to create custom solutions to solve what 
> appears to be a very common problem. 
> 
> During the Christmas downtime, I decided to scratch this itch, and am putting 
> together what will hopefully turn into a solution to what I'll describe 
> below. I'm writing this here to get a sense of what the Django community sees 
> in this: is this a niche problem, is it shared by a few others, or is the 
> lack of these features a fundamental overnight in the core Django product?
> 
> *The problems *(from highest to lowest priority)*:*
> *
> *
> *1)* a form is rendered, the data is changed by a different task/request, 
> then the form is submitted, overwriting the recent changes.
> 
> Whenever models can be modified by multiple users (or even the same user in 
> different windows/tabs of their browser), this can happen. Also, if there are 
> any background processes which can modify the data (e.g. celery, or various 
> data synchronisation services), it's possible.
> In some situations this is no big deal, as the users do not really care, or 
> you know that the latest data would overwrite the previous data anyway. But 
> in general, this is a major risk, particularly when dealing with any health 
> or financial data. 
> 
> *2)* Not being able to safely lock a model/queryset beyond the lifetime of 
> the request.
> 
> This is related to problem 1, and solving problem 2 may in some circumstances 
> solve problem 1 - but not always. For example, depending on how the lock is 
> implemented, a "rogue" task/request may bypass the locking mechanism and 
> force a change to the underlying data. Also, if a lock is based on a session, 
> a user may have multiple tabs open in the same browser, using the same 
> session state (via shared cookies)
> 
> Solving this problem will reduce the chance that when a person does post a 
> form update, that there is any conflict, meaning fewer tears.
> 
> *3)* Not knowing that data has changed on the server until you submit a form.
> 
> Ideally there would be a means for someone viewing/editing a form to 
> immediately be notified if data changes on the server, obsoleting the current 
> form. This reduces the amount of wasted time is spent completing a form which 
> is already known to be out of sync, and will need to be redone anyway (as 
> long as problem 1 is solved; otherwise, there'll be data loss)
> 
> *4)* Smarter form validation
> 
> There are three types of missing validation: 
> - the first is that the default widgets do not support even very simple 
> client-side validation. For example, a text field might need to match a 
> regular expression. 
> - the second type is an ability to provide (in the model definition) 
> arbitrary javascript which can be executed client-side to provide richer 
> realtime validation during data entry.
> - the third type involves effectively providing provisional form data to the 
> server, and having Django validate() the form content without actually saving 
> the result. This would allow (for example) inter-field dependencies to be 
> evaluated without any custom code, providing near-realtime feedback to the 
> user that their form is invalid
> 
> 
> *The solutions*
> This is based on a day or so's experimentation, and I very much welcome any 
> feedback, both in terms of the usefulness of solving these problems in 
> general, as well as suggestion on better ways to solve the problems,  before 
> I go too far down any rabbit holes.
> 
> *Enhanced forms*
> - when rendering a form (using e.g. as_p()), alongside the normal INPUT DOM 
> elements, include additional hidden fields which store a copy of each form 
> field's initial value. 
> - when a form is submitted, compare these hidden values against the current 
> value in the database. If any of these do not match, the clean() method can 
> raise a ValidationError, allowing the user to know what has happened, and 
> that they will need to reload the form and try again, with the new stored 
> values.
> 
> This solution is minimally invasive. As well as modifying as_p() and friends, 
> a django template tag can also be exposed for those users who are rendering 
> their forms in a different way.
> Note that there is no reliance on additional attributed in the models: the 
> CAS-like checking performed is explicitly on the rendered form fields; it 
> doe

Eliminating inter-request race conditions

2021-12-27 Thread Nick Farrell
Hi all.

I've been using Django for quite a number of years now, in various ways. 
Most of the time, I find myself needing to create custom solutions to solve 
what appears to be a very common problem. 

During the Christmas downtime, I decided to scratch this itch, and am 
putting together what will hopefully turn into a solution to what I'll 
describe below. I'm writing this here to get a sense of what the Django 
community sees in this: is this a niche problem, is it shared by a few 
others, or is the lack of these features a fundamental overnight in the 
core Django product?

*The problems *(from highest to lowest priority)*:*

*1)* a form is rendered, the data is changed by a different task/request, 
then the form is submitted, overwriting the recent changes.

Whenever models can be modified by multiple users (or even the same user in 
different windows/tabs of their browser), this can happen. Also, if there 
are any background processes which can modify the data (e.g. celery, or 
various data synchronisation services), it's possible.
In some situations this is no big deal, as the users do not really care, or 
you know that the latest data would overwrite the previous data anyway. But 
in general, this is a major risk, particularly when dealing with any health 
or financial data. 

*2)* Not being able to safely lock a model/queryset beyond the lifetime of 
the request.

This is related to problem 1, and solving problem 2 may in some 
circumstances solve problem 1 - but not always. For example, depending on 
how the lock is implemented, a "rogue" task/request may bypass the locking 
mechanism and force a change to the underlying data. Also, if a lock is 
based on a session, a user may have multiple tabs open in the same browser, 
using the same session state (via shared cookies)

Solving this problem will reduce the chance that when a person does post a 
form update, that there is any conflict, meaning fewer tears.

*3)* Not knowing that data has changed on the server until you submit a 
form.

Ideally there would be a means for someone viewing/editing a form to 
immediately be notified if data changes on the server, obsoleting the 
current form. This reduces the amount of wasted time is spent completing a 
form which is already known to be out of sync, and will need to be redone 
anyway (as long as problem 1 is solved; otherwise, there'll be data loss)

*4)* Smarter form validation

There are three types of missing validation: 
- the first is that the default widgets do not support even very simple 
client-side validation. For example, a text field might need to match a 
regular expression. 
- the second type is an ability to provide (in the model definition) 
arbitrary javascript which can be executed client-side to provide richer 
realtime validation during data entry.
- the third type involves effectively providing provisional form data to 
the server, and having Django validate() the form content without actually 
saving the result. This would allow (for example) inter-field dependencies 
to be evaluated without any custom code, providing near-realtime feedback 
to the user that their form is invalid


*The solutions*
This is based on a day or so's experimentation, and I very much welcome any 
feedback, both in terms of the usefulness of solving these problems in 
general, as well as suggestion on better ways to solve the problems,  
before I go too far down any rabbit holes.

*Enhanced forms*
- when rendering a form (using e.g. as_p()), alongside the normal INPUT DOM 
elements, include additional hidden fields which store a copy of each form 
field's initial value. 
- when a form is submitted, compare these hidden values against the current 
value in the database. If any of these do not match, the clean() method can 
raise a ValidationError, allowing the user to know what has happened, and 
that they will need to reload the form and try again, with the new stored 
values.

This solution is minimally invasive. As well as modifying as_p() and 
friends, a django template tag can also be exposed for those users who are 
rendering their forms in a different way.
Note that there is no reliance on additional attributed in the models: the 
CAS-like checking performed is explicitly on the rendered form fields; it 
does not matter if other model fields' values have changed, as someone 
editing the form can neither see these field values, nor will their POSTing 
modify these other fields' values.
(I have implemented the above already, for generic model forms using a 
single model)

*Locking*
- provide a mixin which can be used on selected models. When used, a view 
(usually some sort of form view) can attempt to lock() the model. If 
successful (because it's not currently locked to someone else), only they 
can perform writes to the model, until the lock expires. 
- if the lock has expired, anyone (including the user who took out an 
expire

Re: Can't able to accept the friend request in my django website

2021-12-07 Thread Bazil M H
Please format your question correctly so that someone can understand that. 
Then only people can answer your question.

On Friday, 3 December 2021 at 05:57:22 UTC+5:30 Kasper Laudrup wrote:

> https://www.propublica.org/nerds/how-to-ask-programming-questions
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3bd1bb82-cfe3-4438-a24c-dbf64b1a7ad2n%40googlegroups.com.


Re: How to get a variable from an ajax request and use it in another application in Django?

2021-12-04 Thread David Nugent
There's a little more to handling session data than what you have there
(unless code is missing?).

IIRC you need to set `session.modified = True` in order to persist the data.

Where are you serialising the session data? db, redis .. ?

Regards, David

On Fri, Dec 3, 2021 at 11:00 PM kayhan  wrote:

> Hi
> Sorry, as you said I used the session.
> But my problem has not been solved yet.
>
> I first send a request to Django and save its data with a session.
> I will send another request to Django later. Here I want to use the data
> of the previous request.
> But my code does not work properly. And the value "None" appears in the
> output.
> Thankful
>
> def planing(request): if request.is_ajax(): # Get user location from user
> location.js file: latitude = request.POST.get('latitude', None) longitude
> = request.POST.get('longitude', None) print("latitude, longitude = ",
> latitude,longitude) # To save data request.session['latitude'] = latitude
> request.session['longitude'] = longitude # To retrieve data: latitude =
> request.session.get('latitude') longitude = request.session.get(
> 'longitude') print("latitude, longitude = ", latitude,longitude) elif
> request.method == "GET": return render(request, "tourist/planing.html")
> elif request.method == "POST": # To retrieve data: latitude =
> request.session.get('latitude') longitude = request.session.get(
> 'longitude') print("latitude, longitude = ", latitude,longitude) Output:
> latitude, longitude = 34.801595 48.499574 latitude, longitude = 34.801595
> 48.499574 latitude, longitude = None None
>
> On Wed, Dec 1, 2021 at 6:37 PM kayhan  wrote:
>
>> Thank you David🙏🙏
>>
>> On Wed, Dec 1, 2021 at 3:56 AM David Nugent  wrote:
>>
>>> That is definitely much more clear.
>>>
>>> The usual way of doing this is to handle it like a shopping cart (plenty
>>> of examples only a google search away).
>>> Typically you store this information in the user's session in the first
>>> view, then retrieve it in the subsequent view(s).
>>>
>>> Note that `request.is_ajax` is deprecated and does not even exist
>>> anymore in Django 3.x. You can guess that from other info, but you should
>>> probably use a
>>> different view for handling the ajax request in any case, for clarity
>>> and maintainability. The response data would usually use a different format
>>> (json vs text/html).
>>>
>>> Regards, David
>>>
>>> On Wed, Dec 1, 2021 at 6:04 AM kayhan  wrote:
>>>
>>>> Sorry I did not ask the question well.
>>>> Question:
>>>> How to first send some data with an Ajax request to Django view and
>>>> then with a post request, send the form information to the same view and
>>>> use the data sent in the previous request (Ajax request) in the second
>>>> request ?
>>>>
>>>> def planing(request):
>>>>
>>>> if request.is_ajax():
>>>> # Get user location from user location.js file:
>>>> latitude = request.POST.get('latitude', None)
>>>> longitude = request.POST.get('longitude', None)
>>>>
>>>>
>>>> elif request.method == "GET":
>>>> return render(request, "tourist/planing.html")
>>>>
>>>>
>>>> elif request.method == "POST":
>>>> # Here I want to take the form data and have
>>>> #the previous request data (latitude, longitude) here and do a series
>>>> of processing.
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAE5VhgWbiA8Ayhkss1saVg9my_S%2Bw8e1SYxhwp3xGCTD2L8snA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAE5VhgWbiA8Ayhkss1saVg9my_S%2Bw8e1SYxhwp3xGCTD2L8snA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAO-vjERuNQuJYLB6_67S_yV3AQhHaenoPWdAJwJ183GHYT2rGw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAO-vjERuNQuJYLB6_67S_yV3AQhHaenoPWdAJwJ183GHYT2rGw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE5VhgXiGgfahTnvoXxk31bM4SQPWj3bNas7G%2B9g%2BoAV-XouhA%40mail.gmail.com.


Re: Use previously requested data in another request

2021-12-04 Thread kayhan
Thankyou 🙏

On Sat, Dec 4, 2021 at 11:33 AM Lalit Suthar 
wrote:

> tried to look into the docs but couldn't find a reason.
> you can go through this page to find out any possible reason
> https://docs.djangoproject.com/en/dev/topics/http/sessions/
>
> On Fri, 3 Dec 2021 at 23:19, kayhan  wrote:
>
>> Thanks but I did not change the settings.
>> And to test, SESSION_COOKIE_AGE = 5 * 60,
>>   I added to the settings but there is still the same problem.
>>
>> On Fri, Dec 3, 2021 at 8:55 PM Lalit Suthar 
>> wrote:
>>
>>> We can save that in any django model in ajax() request if possible.
>>>
>>> You can check if you have modified `SESSION_COOKIE_AGE` (
>>> https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-SESSION_COOKIE_AGE
>>> )
>>> if it is too less that might be the reason.
>>>
>>> On Fri, 3 Dec 2021 at 16:15, kayhan  wrote:
>>>
>>>> Hi
>>>> I first send a request to Django and save its data with a session.
>>>> I will send another request to Django later. Here I want to use the
>>>> data of the previous request.
>>>> But my code does not work properly. And the value "None" appears in the
>>>> output.
>>>> Does anyone know what I should do?
>>>> Thankful
>>>>
>>>> def planing(request): if request.is_ajax(): # Get user location from
>>>> user location.js file: latitude = request.POST.get('latitude', None)
>>>> longitude = request.POST.get('longitude', None) print("latitude,
>>>> longitude = ", latitude,longitude) # To save data request.session[
>>>> 'latitude'] = latitude request.session['longitude'] = longitude # To
>>>> retrive data: latitude = request.session.get('latitude') longitude =
>>>> request.session.get('longitude') print("latitude, longitude = ",
>>>> latitude,longitude) elif request.method == "GET": return
>>>> render(request, "tourist/planing.html") elif request.method == "POST": #
>>>> To retrive data: latitude = request.session.get('latitude') longitude
>>>> = request.session.get('longitude') print("latitude, longitude = ",
>>>> latitude,longitude) Output: latitude, longitude = 34.801595 48.499574
>>>> latitude, longitude = 34.801595 48.499574 latitude, longitude = None
>>>> None
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/4bef9d07-cd92-440a-8ec0-dd4c206e6ae7n%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/4bef9d07-cd92-440a-8ec0-dd4c206e6ae7n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAGp2JVEkLiwVEAF3uV%3DBBOQJuUwVBaQGhD7RA7t0aDirh%2BD-ZQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAGp2JVEkLiwVEAF3uV%3DBBOQJuUwVBaQGhD7RA7t0aDirh%2BD-ZQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAO-vjETOG1Nq%3D_Evk7ryvr27eBxtDSQfiygKV%3Djq9TTzkiuPTw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAO-vjETOG1Nq%3D_Evk7ryvr27eBxtDSQfiygKV%3Djq9TTzkiuPTw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGp2JVE1byyT%2BO8Rxx%2BuGh49ouxvMs8MLmHHWzL-1c_WR8ssnw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGp2JVE1byyT%2BO8Rxx%2BuGh49ouxvMs8MLmHHWzL-1c_WR8ssnw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO-vjES24HDPNXmxZS6i5K%2BVYTO7W5rDQtZLsn%3DjnYy694XuHw%40mail.gmail.com.


Re: Use previously requested data in another request

2021-12-04 Thread Lalit Suthar
tried to look into the docs but couldn't find a reason.
you can go through this page to find out any possible reason
https://docs.djangoproject.com/en/dev/topics/http/sessions/

On Fri, 3 Dec 2021 at 23:19, kayhan  wrote:

> Thanks but I did not change the settings.
> And to test, SESSION_COOKIE_AGE = 5 * 60,
>   I added to the settings but there is still the same problem.
>
> On Fri, Dec 3, 2021 at 8:55 PM Lalit Suthar 
> wrote:
>
>> We can save that in any django model in ajax() request if possible.
>>
>> You can check if you have modified `SESSION_COOKIE_AGE` (
>> https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-SESSION_COOKIE_AGE
>> )
>> if it is too less that might be the reason.
>>
>> On Fri, 3 Dec 2021 at 16:15, kayhan  wrote:
>>
>>> Hi
>>> I first send a request to Django and save its data with a session.
>>> I will send another request to Django later. Here I want to use the data
>>> of the previous request.
>>> But my code does not work properly. And the value "None" appears in the
>>> output.
>>> Does anyone know what I should do?
>>> Thankful
>>>
>>> def planing(request): if request.is_ajax(): # Get user location from
>>> user location.js file: latitude = request.POST.get('latitude', None)
>>> longitude = request.POST.get('longitude', None) print("latitude,
>>> longitude = ", latitude,longitude) # To save data request.session[
>>> 'latitude'] = latitude request.session['longitude'] = longitude # To
>>> retrive data: latitude = request.session.get('latitude') longitude =
>>> request.session.get('longitude') print("latitude, longitude = ",
>>> latitude,longitude) elif request.method == "GET": return
>>> render(request, "tourist/planing.html") elif request.method == "POST": #
>>> To retrive data: latitude = request.session.get('latitude') longitude =
>>> request.session.get('longitude') print("latitude, longitude = ",
>>> latitude,longitude) Output: latitude, longitude = 34.801595 48.499574
>>> latitude, longitude = 34.801595 48.499574 latitude, longitude = None
>>> None
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/4bef9d07-cd92-440a-8ec0-dd4c206e6ae7n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/4bef9d07-cd92-440a-8ec0-dd4c206e6ae7n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAGp2JVEkLiwVEAF3uV%3DBBOQJuUwVBaQGhD7RA7t0aDirh%2BD-ZQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAGp2JVEkLiwVEAF3uV%3DBBOQJuUwVBaQGhD7RA7t0aDirh%2BD-ZQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAO-vjETOG1Nq%3D_Evk7ryvr27eBxtDSQfiygKV%3Djq9TTzkiuPTw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAO-vjETOG1Nq%3D_Evk7ryvr27eBxtDSQfiygKV%3Djq9TTzkiuPTw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVE1byyT%2BO8Rxx%2BuGh49ouxvMs8MLmHHWzL-1c_WR8ssnw%40mail.gmail.com.


Re: Use previously requested data in another request

2021-12-03 Thread kayhan
Thanks but I did not change the settings.
And to test, SESSION_COOKIE_AGE = 5 * 60,
  I added to the settings but there is still the same problem.

On Fri, Dec 3, 2021 at 8:55 PM Lalit Suthar 
wrote:

> We can save that in any django model in ajax() request if possible.
>
> You can check if you have modified `SESSION_COOKIE_AGE` (
> https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-SESSION_COOKIE_AGE
> )
> if it is too less that might be the reason.
>
> On Fri, 3 Dec 2021 at 16:15, kayhan  wrote:
>
>> Hi
>> I first send a request to Django and save its data with a session.
>> I will send another request to Django later. Here I want to use the data
>> of the previous request.
>> But my code does not work properly. And the value "None" appears in the
>> output.
>> Does anyone know what I should do?
>> Thankful
>>
>> def planing(request): if request.is_ajax(): # Get user location from
>> user location.js file: latitude = request.POST.get('latitude', None)
>> longitude = request.POST.get('longitude', None) print("latitude,
>> longitude = ", latitude,longitude) # To save data request.session[
>> 'latitude'] = latitude request.session['longitude'] = longitude # To
>> retrive data: latitude = request.session.get('latitude') longitude =
>> request.session.get('longitude') print("latitude, longitude = ",
>> latitude,longitude) elif request.method == "GET": return render(request,
>> "tourist/planing.html") elif request.method == "POST": # To retrive data:
>> latitude = request.session.get('latitude') longitude =
>> request.session.get('longitude') print("latitude, longitude = ",
>> latitude,longitude) Output: latitude, longitude = 34.801595 48.499574
>> latitude, longitude = 34.801595 48.499574 latitude, longitude = None None
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/4bef9d07-cd92-440a-8ec0-dd4c206e6ae7n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/4bef9d07-cd92-440a-8ec0-dd4c206e6ae7n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGp2JVEkLiwVEAF3uV%3DBBOQJuUwVBaQGhD7RA7t0aDirh%2BD-ZQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGp2JVEkLiwVEAF3uV%3DBBOQJuUwVBaQGhD7RA7t0aDirh%2BD-ZQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO-vjETOG1Nq%3D_Evk7ryvr27eBxtDSQfiygKV%3Djq9TTzkiuPTw%40mail.gmail.com.


Re: Use previously requested data in another request

2021-12-03 Thread Lalit Suthar
We can save that in any django model in ajax() request if possible.

You can check if you have modified `SESSION_COOKIE_AGE` (
https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-SESSION_COOKIE_AGE
)
if it is too less that might be the reason.

On Fri, 3 Dec 2021 at 16:15, kayhan  wrote:

> Hi
> I first send a request to Django and save its data with a session.
> I will send another request to Django later. Here I want to use the data
> of the previous request.
> But my code does not work properly. And the value "None" appears in the
> output.
> Does anyone know what I should do?
> Thankful
>
> def planing(request): if request.is_ajax(): # Get user location from user
> location.js file: latitude = request.POST.get('latitude', None) longitude
> = request.POST.get('longitude', None) print("latitude, longitude = ",
> latitude,longitude) # To save data request.session['latitude'] = latitude
> request.session['longitude'] = longitude # To retrive data: latitude =
> request.session.get('latitude') longitude = request.session.get(
> 'longitude') print("latitude, longitude = ", latitude,longitude) elif
> request.method == "GET": return render(request, "tourist/planing.html")
> elif request.method == "POST": # To retrive data: latitude =
> request.session.get('latitude') longitude = request.session.get(
> 'longitude') print("latitude, longitude = ", latitude,longitude) Output:
> latitude, longitude = 34.801595 48.499574 latitude, longitude = 34.801595
> 48.499574 latitude, longitude = None None
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4bef9d07-cd92-440a-8ec0-dd4c206e6ae7n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4bef9d07-cd92-440a-8ec0-dd4c206e6ae7n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEkLiwVEAF3uV%3DBBOQJuUwVBaQGhD7RA7t0aDirh%2BD-ZQ%40mail.gmail.com.


Re: How to get a variable from an ajax request and use it in another application in Django?

2021-12-03 Thread kayhan
Hi
Sorry, as you said I used the session.
But my problem has not been solved yet.

I first send a request to Django and save its data with a session.
I will send another request to Django later. Here I want to use the data of
the previous request.
But my code does not work properly. And the value "None" appears in the
output.
Thankful

def planing(request): if request.is_ajax(): # Get user location from user
location.js file: latitude = request.POST.get('latitude', None) longitude =
request.POST.get('longitude', None) print("latitude, longitude = ",
latitude,longitude) # To save data request.session['latitude'] = latitude
request.session['longitude'] = longitude # To retrieve data: latitude =
request.session.get('latitude') longitude = request.session.get('longitude')
print("latitude, longitude = ", latitude,longitude) elif request.method ==
"GET": return render(request, "tourist/planing.html") elif request.method
== "POST": # To retrieve data: latitude = request.session.get('latitude')
longitude = request.session.get('longitude') print("latitude, longitude = ",
latitude,longitude) Output: latitude, longitude = 34.801595 48.499574
latitude, longitude = 34.801595 48.499574 latitude, longitude = None None

On Wed, Dec 1, 2021 at 6:37 PM kayhan  wrote:

> Thank you David🙏🙏
>
> On Wed, Dec 1, 2021 at 3:56 AM David Nugent  wrote:
>
>> That is definitely much more clear.
>>
>> The usual way of doing this is to handle it like a shopping cart (plenty
>> of examples only a google search away).
>> Typically you store this information in the user's session in the first
>> view, then retrieve it in the subsequent view(s).
>>
>> Note that `request.is_ajax` is deprecated and does not even exist anymore
>> in Django 3.x. You can guess that from other info, but you should probably
>> use a
>> different view for handling the ajax request in any case, for clarity and
>> maintainability. The response data would usually use a different format
>> (json vs text/html).
>>
>> Regards, David
>>
>> On Wed, Dec 1, 2021 at 6:04 AM kayhan  wrote:
>>
>>> Sorry I did not ask the question well.
>>> Question:
>>> How to first send some data with an Ajax request to Django view and then
>>> with a post request, send the form information to the same view and use the
>>> data sent in the previous request (Ajax request) in the second request ?
>>>
>>> def planing(request):
>>>
>>> if request.is_ajax():
>>> # Get user location from user location.js file:
>>> latitude = request.POST.get('latitude', None)
>>> longitude = request.POST.get('longitude', None)
>>>
>>>
>>> elif request.method == "GET":
>>> return render(request, "tourist/planing.html")
>>>
>>>
>>> elif request.method == "POST":
>>> # Here I want to take the form data and have
>>> #the previous request data (latitude, longitude) here and do a series of
>>> processing.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAE5VhgWbiA8Ayhkss1saVg9my_S%2Bw8e1SYxhwp3xGCTD2L8snA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAE5VhgWbiA8Ayhkss1saVg9my_S%2Bw8e1SYxhwp3xGCTD2L8snA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO-vjERuNQuJYLB6_67S_yV3AQhHaenoPWdAJwJ183GHYT2rGw%40mail.gmail.com.


Use previously requested data in another request

2021-12-03 Thread kayhan
Hi
I first send a request to Django and save its data with a session.
I will send another request to Django later. Here I want to use the data of 
the previous request.
But my code does not work properly. And the value "None" appears in the 
output.
Does anyone know what I should do?
Thankful

def planing(request): if request.is_ajax(): # Get user location from user 
location.js file: latitude = request.POST.get('latitude', None) longitude = 
request.POST.get('longitude', None) print("latitude, longitude = ", 
latitude,longitude) # To save data request.session['latitude'] = latitude 
request.session['longitude'] = longitude # To retrive data: latitude = 
request.session.get('latitude') longitude = request.session.get('longitude') 
print("latitude, longitude = ", latitude,longitude) elif request.method == 
"GET": return render(request, "tourist/planing.html") elif request.method 
== "POST": # To retrive data: latitude = request.session.get('latitude') 
longitude = request.session.get('longitude') print("latitude, longitude = ", 
latitude,longitude) Output: latitude, longitude = 34.801595 48.499574 
latitude, longitude = 34.801595 48.499574 latitude, longitude = None None

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4bef9d07-cd92-440a-8ec0-dd4c206e6ae7n%40googlegroups.com.


Re: Can't able to accept the friend request in my django website

2021-12-02 Thread Kasper Laudrup

https://www.propublica.org/nerds/how-to-ask-programming-questions

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ce52c543-aa41-9235-acc5-ea333f5cd3a2%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Can't able to accept the friend request in my django website

2021-12-02 Thread Rohan buks
I'm getting the following error:

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/users/friend-request/accept/7/

Django Version: 2.1
Python Version: 3.8.10
Installed Applications:
['users.apps.UsersConfig',
 'feed.apps.FeedConfig',
 'crispy_forms',
 'stdimage',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/backends/utils.py"
 
in _execute
  85. return self.cursor.execute(sql, params)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py"
 
in execute
  296. return Database.Cursor.execute(self, query, params)

The above exception (no such table: main.users_profile__old) was the direct 
cause of the following exception:

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/core/handlers/exception.py"
 
in inner
  34. response = get_response(request)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/core/handlers/base.py"
 
in _get_response
  126. response = self.process_exception_by_middleware(e, 
request)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/core/handlers/base.py"
 
in _get_response
  124. response = wrapped_callback(request, *callback_args, 
**callback_kwargs)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/contrib/auth/decorators.py"
 
in _wrapped_view
  21. return view_func(request, *args, **kwargs)

File "/home/rohan/ByteWalk-master/users/views.py" in accept_friend_request
  88. user1.profile.friends.add(user2.profile)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/models/fields/related_descriptors.py"
 
in add
  926. self._add_items(self.source_field_name, 
self.target_field_name, *objs)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/models/fields/related_descriptors.py"
 
in _add_items
  1088.
 self.through._default_manager.using(db).bulk_create([

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/models/query.py"
 
in bulk_create
  465. ids = self._batched_insert(objs_without_pk, fields, 
batch_size)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/models/query.py"
 
in _batched_insert
  1152. self._insert(item, fields=fields, using=self.db)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/models/query.py"
 
in _insert
  1133. return 
query.get_compiler(using=using).execute_sql(return_id)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/models/sql/compiler.py"
 
in execute_sql
  1285. cursor.execute(sql, params)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/backends/utils.py"
 
in execute
  100. return super().execute(sql, params)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/backends/utils.py"
 
in execute
  68. return self._execute_with_wrappers(sql, params, many=False, 
executor=self._execute)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/backends/utils.py"
 
in _execute_with_wrappers
  77. return executor(sql, params, many, context)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/backends/utils.py"
 
in _execute
  85. return self.cursor.execute(sql, params)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/utils.py"
 
in __exit__
  89. raise dj_exc_value.with

Re: Use previous requested data in the new request

2021-12-02 Thread kayhan
Because first the site user allows us to access their location information.
And then we use JavaScript code to get his location and send it to Django.
The user then fills out another form and sends it to Django. When this form
is submitted, we use the information in this form and the location
information that was previously submitted for processing.

On Thu, Dec 2, 2021 at 10:09 AM Lalit Suthar 
wrote:

> why can't we make a post request directly
>
> On Wed, 1 Dec 2021 at 00:24, kayhan  wrote:
>
>> Hi
>> How to first send some data with an Ajax request to Django view and then
>> with a post request, send the form information to the same view and use the
>> data sent in the previous request (Ajax request) in the second request ?
>>
>> def planing(request):
>>
>> if request.is_ajax():
>> # Get user location from user location.js file:
>> latitude = request.POST.get('latitude', None)
>> longitude = request.POST.get('longitude', None)
>>
>>
>> elif request.method == "GET":
>> return render(request, "tourist/planing.html")
>>
>>
>> elif request.method == "POST":
>> # Here I want to take the form data and have
>> #the previous request data (latitude, longitude) here and do a series of
>> processing
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/317b8fc4-d607-49fc-888b-8030baf0f142n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/317b8fc4-d607-49fc-888b-8030baf0f142n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGp2JVFjNMyr%3DMNgohabEw3J6YVn50GX0pfXCcurTv6HiMWoGA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGp2JVFjNMyr%3DMNgohabEw3J6YVn50GX0pfXCcurTv6HiMWoGA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO-vjERyaC%3D8Oxd%3DdwX6Q2LB-fWgSQ4vyWUDfFhdZcWO4xuqnA%40mail.gmail.com.


Re: Use previous requested data in the new request

2021-12-01 Thread Lalit Suthar
why can't we make a post request directly

On Wed, 1 Dec 2021 at 00:24, kayhan  wrote:

> Hi
> How to first send some data with an Ajax request to Django view and then
> with a post request, send the form information to the same view and use the
> data sent in the previous request (Ajax request) in the second request ?
>
> def planing(request):
>
> if request.is_ajax():
> # Get user location from user location.js file:
> latitude = request.POST.get('latitude', None)
> longitude = request.POST.get('longitude', None)
>
>
> elif request.method == "GET":
> return render(request, "tourist/planing.html")
>
>
> elif request.method == "POST":
> # Here I want to take the form data and have
> #the previous request data (latitude, longitude) here and do a series of
> processing
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/317b8fc4-d607-49fc-888b-8030baf0f142n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/317b8fc4-d607-49fc-888b-8030baf0f142n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFjNMyr%3DMNgohabEw3J6YVn50GX0pfXCcurTv6HiMWoGA%40mail.gmail.com.


Re: How to get a variable from an ajax request and use it in another application in Django?

2021-12-01 Thread kayhan
Thank you David🙏🙏

On Wed, Dec 1, 2021 at 3:56 AM David Nugent  wrote:

> That is definitely much more clear.
>
> The usual way of doing this is to handle it like a shopping cart (plenty
> of examples only a google search away).
> Typically you store this information in the user's session in the first
> view, then retrieve it in the subsequent view(s).
>
> Note that `request.is_ajax` is deprecated and does not even exist anymore
> in Django 3.x. You can guess that from other info, but you should probably
> use a
> different view for handling the ajax request in any case, for clarity and
> maintainability. The response data would usually use a different format
> (json vs text/html).
>
> Regards, David
>
> On Wed, Dec 1, 2021 at 6:04 AM kayhan  wrote:
>
>> Sorry I did not ask the question well.
>> Question:
>> How to first send some data with an Ajax request to Django view and then
>> with a post request, send the form information to the same view and use the
>> data sent in the previous request (Ajax request) in the second request ?
>>
>> def planing(request):
>>
>> if request.is_ajax():
>> # Get user location from user location.js file:
>> latitude = request.POST.get('latitude', None)
>> longitude = request.POST.get('longitude', None)
>>
>>
>> elif request.method == "GET":
>> return render(request, "tourist/planing.html")
>>
>>
>> elif request.method == "POST":
>> # Here I want to take the form data and have
>> #the previous request data (latitude, longitude) here and do a series of
>> processing.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAE5VhgWbiA8Ayhkss1saVg9my_S%2Bw8e1SYxhwp3xGCTD2L8snA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAE5VhgWbiA8Ayhkss1saVg9my_S%2Bw8e1SYxhwp3xGCTD2L8snA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO-vjEROTTYwPQF3f3LSgAByk0C2MqTA-0SD_89%2BeBDtGUA1Aw%40mail.gmail.com.


Re: How to get a variable from an ajax request and use it in another application in Django?

2021-11-30 Thread David Nugent
That is definitely much more clear.

The usual way of doing this is to handle it like a shopping cart (plenty of
examples only a google search away).
Typically you store this information in the user's session in the first
view, then retrieve it in the subsequent view(s).

Note that `request.is_ajax` is deprecated and does not even exist anymore
in Django 3.x. You can guess that from other info, but you should probably
use a
different view for handling the ajax request in any case, for clarity and
maintainability. The response data would usually use a different format
(json vs text/html).

Regards, David

On Wed, Dec 1, 2021 at 6:04 AM kayhan  wrote:

> Sorry I did not ask the question well.
> Question:
> How to first send some data with an Ajax request to Django view and then
> with a post request, send the form information to the same view and use the
> data sent in the previous request (Ajax request) in the second request ?
>
> def planing(request):
>
> if request.is_ajax():
> # Get user location from user location.js file:
> latitude = request.POST.get('latitude', None)
> longitude = request.POST.get('longitude', None)
>
>
> elif request.method == "GET":
> return render(request, "tourist/planing.html")
>
>
> elif request.method == "POST":
> # Here I want to take the form data and have
> #the previous request data (latitude, longitude) here and do a series of
> processing.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE5VhgWbiA8Ayhkss1saVg9my_S%2Bw8e1SYxhwp3xGCTD2L8snA%40mail.gmail.com.


Re: How to get a variable from an ajax request and use it in another application in Django?

2021-11-30 Thread kayhan
Sorry I did not ask the question well.
Question:
How to first send some data with an Ajax request to Django view and then
with a post request, send the form information to the same view and use the
data sent in the previous request (Ajax request) in the second request ?

def planing(request):

if request.is_ajax():
# Get user location from user location.js file:
latitude = request.POST.get('latitude', None)
longitude = request.POST.get('longitude', None)


elif request.method == "GET":
return render(request, "tourist/planing.html")


elif request.method == "POST":
# Here I want to take the form data and have
#the previous request data (latitude, longitude) here and do a series of
processing.


On Tue, Nov 30, 2021 at 1:53 AM David Nugent  wrote:

> A little more context would help, "use it in another application" is a
> little vague. The backend the API request and can pretty much do anything
> you need in the corresponding view at that point but should endeavour to
> return an appropriate response ASAP.
>
> On Tue, Nov 30, 2021 at 12:35 AM kayhan  wrote:
>
>> How to get a variable from an ajax request and use it in another
>> application in Django?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/a0d16b47-bb60-46e3-bb5a-53ec718cf172n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/a0d16b47-bb60-46e3-bb5a-53ec718cf172n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAE5VhgW-A1K8H%2BpOd499c59tnGMwUSRv%3DVxEOsSNf1XGtzRAmA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAE5VhgW-A1K8H%2BpOd499c59tnGMwUSRv%3DVxEOsSNf1XGtzRAmA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO-vjETw66Q8AEMupba7AQr5o%3D1j%2B5VWF4wV_EWQv%3DV5ZRwBKg%40mail.gmail.com.


Use previous requested data in the new request

2021-11-30 Thread kayhan
Hi
How to first send some data with an Ajax request to Django view and then 
with a post request, send the form information to the same view and use the 
data sent in the previous request (Ajax request) in the second request ?

def planing(request):   
  
if request.is_ajax():
# Get user location from user location.js file:
latitude = request.POST.get('latitude', None)
longitude = request.POST.get('longitude', None)


elif request.method == "GET":
return render(request, "tourist/planing.html")

  
elif request.method == "POST":
# Here I want to take the form data and have 
#the previous request data (latitude, longitude) here and do a series of 
processing

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/317b8fc4-d607-49fc-888b-8030baf0f142n%40googlegroups.com.


Re: How to get a variable from an ajax request and use it in another application in Django?

2021-11-29 Thread David Nugent
A little more context would help, "use it in another application" is a
little vague. The backend the API request and can pretty much do anything
you need in the corresponding view at that point but should endeavour to
return an appropriate response ASAP.

On Tue, Nov 30, 2021 at 12:35 AM kayhan  wrote:

> How to get a variable from an ajax request and use it in another
> application in Django?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a0d16b47-bb60-46e3-bb5a-53ec718cf172n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a0d16b47-bb60-46e3-bb5a-53ec718cf172n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE5VhgW-A1K8H%2BpOd499c59tnGMwUSRv%3DVxEOsSNf1XGtzRAmA%40mail.gmail.com.


How to get a variable from an ajax request and use it in another application in Django?

2021-11-29 Thread kayhan
How to get a variable from an ajax request and use it in another 
application in Django?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a0d16b47-bb60-46e3-bb5a-53ec718cf172n%40googlegroups.com.


Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread DJANGO DEVELOPER
https://meet.google.com/pns-vbmz-sys

On Wed, Nov 24, 2021 at 12:08 AM DJANGO DEVELOPER 
wrote:

> okay
>
>
> On Wed, Nov 24, 2021 at 12:04 AM Duncan Santiago <
> duncansantiag...@gmail.com> wrote:
>
>> let's try google meet.
>>
>> On Tue, 23 Nov 2021 at 11:39, DJANGO DEVELOPER 
>> wrote:
>>
>>> can I have you on anydesk or any meeting tool?
>>>
>>> On Tue, Nov 23, 2021 at 11:31 PM Duncan Santiago <
>>> duncansantiag...@gmail.com> wrote:
>>>
>>>> send me your code then,
>>>> or GitHub repo handle.
>>>>
>>>> On Tue, 23 Nov 2021 at 11:27, DJANGO DEVELOPER 
>>>> wrote:
>>>>
>>>>> sorry if you get offended because I need a solution. a working
>>>>> solution. I am not familiar with javascript. so getting a lot of issues
>>>>>
>>>>> On Tue, Nov 23, 2021 at 10:38 PM Duncan Santiago <
>>>>> duncansantiag...@gmail.com> wrote:
>>>>>
>>>>>> your page also reloads and results may not be displayed on your
>>>>>> frontend, just add this lines on your onclick listerner
>>>>>>
>>>>>> function(e){ //notice the e parameter, it is the event parameter.
>>>>>> e.preventDefault()
>>>>>>  your code here.
>>>>>>
>>>>>> }
>>>>>>
>>>>>> or you can just paste this on your script section
>>>>>>
>>>>>>
>>>>>> (function () {
>>>>>> var output = document.getElementById('output');
>>>>>> document.getElementById('post').onclick = function (e) {
>>>>>> e.preventDefault()
>>>>>>   var data = document.getElementById('data').value;
>>>>>>
>>>>>>   axios.post('http://127.0.0.1:8000/predict/',
>>>>>> JSON.parse(data))
>>>>>> .then(function (res) {
>>>>>>   output.className = 'container';
>>>>>>   output.innerHTML = res.data;
>>>>>> })
>>>>>> .catch(function (err) {
>>>>>>   output.className = 'container text-danger';
>>>>>>   output.innerHTML = err.message;
>>>>>> });
>>>>>> };
>>>>>>   })();
>>>>>>
>>>>>> On Tue, 23 Nov 2021 at 10:34, Duncan Santiago <
>>>>>> duncansantiag...@gmail.com> wrote:
>>>>>>
>>>>>>> do a demo, enter the URL on the text area and click on the post
>>>>>>> button.
>>>>>>> Then send me the logs on the terminal running Django and also open
>>>>>>> the console and send the output,
>>>>>>>
>>>>>>> On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER <
>>>>>>> abubakarbr...@gmail.com> wrote:
>>>>>>>
>>>>>>>> okay let me explain.
>>>>>>>> I have trained models which tells us that which website is
>>>>>>>> legitimate or which website is not legitimate. I have integrated that 
>>>>>>>> model
>>>>>>>> with my django web app using rest api.
>>>>>>>> I tested the API on postman and working.
>>>>>>>> now I want to get the result on front end using HTML CSS and
>>>>>>>> javascript. so how can I achieve it?
>>>>>>>>
>>>>>>>> On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
>>>>>>>> duncansantiag...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> hello, am not sure what the question is. Kindly elaborate.
>>>>>>>>>
>>>>>>>>> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER <
>>>>>>>>> abubakarbr...@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> I am working on a django based project in which I have integrated
>>>>>>>>>> ML trained models to check if a https url is legitimate or not. for 
>>>>>>>>>> this I
>>>>>>>>>> need javascript or ajax to call a res

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread DJANGO DEVELOPER
okay


On Wed, Nov 24, 2021 at 12:04 AM Duncan Santiago 
wrote:

> let's try google meet.
>
> On Tue, 23 Nov 2021 at 11:39, DJANGO DEVELOPER 
> wrote:
>
>> can I have you on anydesk or any meeting tool?
>>
>> On Tue, Nov 23, 2021 at 11:31 PM Duncan Santiago <
>> duncansantiag...@gmail.com> wrote:
>>
>>> send me your code then,
>>> or GitHub repo handle.
>>>
>>> On Tue, 23 Nov 2021 at 11:27, DJANGO DEVELOPER 
>>> wrote:
>>>
>>>> sorry if you get offended because I need a solution. a working
>>>> solution. I am not familiar with javascript. so getting a lot of issues
>>>>
>>>> On Tue, Nov 23, 2021 at 10:38 PM Duncan Santiago <
>>>> duncansantiag...@gmail.com> wrote:
>>>>
>>>>> your page also reloads and results may not be displayed on your
>>>>> frontend, just add this lines on your onclick listerner
>>>>>
>>>>> function(e){ //notice the e parameter, it is the event parameter.
>>>>> e.preventDefault()
>>>>>  your code here.
>>>>>
>>>>> }
>>>>>
>>>>> or you can just paste this on your script section
>>>>>
>>>>>
>>>>> (function () {
>>>>> var output = document.getElementById('output');
>>>>> document.getElementById('post').onclick = function (e) {
>>>>> e.preventDefault()
>>>>>   var data = document.getElementById('data').value;
>>>>>
>>>>>   axios.post('http://127.0.0.1:8000/predict/',
>>>>> JSON.parse(data))
>>>>> .then(function (res) {
>>>>>   output.className = 'container';
>>>>>   output.innerHTML = res.data;
>>>>> })
>>>>> .catch(function (err) {
>>>>>   output.className = 'container text-danger';
>>>>>   output.innerHTML = err.message;
>>>>> });
>>>>> };
>>>>>   })();
>>>>>
>>>>> On Tue, 23 Nov 2021 at 10:34, Duncan Santiago <
>>>>> duncansantiag...@gmail.com> wrote:
>>>>>
>>>>>> do a demo, enter the URL on the text area and click on the post
>>>>>> button.
>>>>>> Then send me the logs on the terminal running Django and also open
>>>>>> the console and send the output,
>>>>>>
>>>>>> On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER <
>>>>>> abubakarbr...@gmail.com> wrote:
>>>>>>
>>>>>>> okay let me explain.
>>>>>>> I have trained models which tells us that which website is
>>>>>>> legitimate or which website is not legitimate. I have integrated that 
>>>>>>> model
>>>>>>> with my django web app using rest api.
>>>>>>> I tested the API on postman and working.
>>>>>>> now I want to get the result on front end using HTML CSS and
>>>>>>> javascript. so how can I achieve it?
>>>>>>>
>>>>>>> On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
>>>>>>> duncansantiag...@gmail.com> wrote:
>>>>>>>
>>>>>>>> hello, am not sure what the question is. Kindly elaborate.
>>>>>>>>
>>>>>>>> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER <
>>>>>>>> abubakarbr...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> I am working on a django based project in which I have integrated
>>>>>>>>> ML trained models to check if a https url is legitimate or not. for 
>>>>>>>>> this I
>>>>>>>>> need javascript or ajax to call a rest api for my form in which I 
>>>>>>>>> want to
>>>>>>>>> send a post request so that I can check if a https url is legitimate 
>>>>>>>>> or not.
>>>>>>>>> *NOTE: My code is running successfully and giving correct answers
>>>>>>>>> on postman.* so just want to integrate it with my HTML form.
>>>>>>>>> *My work:*
>>>>>>

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread Duncan Santiago
let's try google meet.

On Tue, 23 Nov 2021 at 11:39, DJANGO DEVELOPER 
wrote:

> can I have you on anydesk or any meeting tool?
>
> On Tue, Nov 23, 2021 at 11:31 PM Duncan Santiago <
> duncansantiag...@gmail.com> wrote:
>
>> send me your code then,
>> or GitHub repo handle.
>>
>> On Tue, 23 Nov 2021 at 11:27, DJANGO DEVELOPER 
>> wrote:
>>
>>> sorry if you get offended because I need a solution. a working solution.
>>> I am not familiar with javascript. so getting a lot of issues
>>>
>>> On Tue, Nov 23, 2021 at 10:38 PM Duncan Santiago <
>>> duncansantiag...@gmail.com> wrote:
>>>
>>>> your page also reloads and results may not be displayed on your
>>>> frontend, just add this lines on your onclick listerner
>>>>
>>>> function(e){ //notice the e parameter, it is the event parameter.
>>>> e.preventDefault()
>>>>  your code here.
>>>>
>>>> }
>>>>
>>>> or you can just paste this on your script section
>>>>
>>>>
>>>> (function () {
>>>> var output = document.getElementById('output');
>>>> document.getElementById('post').onclick = function (e) {
>>>> e.preventDefault()
>>>>   var data = document.getElementById('data').value;
>>>>
>>>>   axios.post('http://127.0.0.1:8000/predict/',
>>>> JSON.parse(data))
>>>> .then(function (res) {
>>>>   output.className = 'container';
>>>>   output.innerHTML = res.data;
>>>> })
>>>> .catch(function (err) {
>>>>   output.className = 'container text-danger';
>>>>   output.innerHTML = err.message;
>>>> });
>>>> };
>>>>   })();
>>>>
>>>> On Tue, 23 Nov 2021 at 10:34, Duncan Santiago <
>>>> duncansantiag...@gmail.com> wrote:
>>>>
>>>>> do a demo, enter the URL on the text area and click on the post button.
>>>>> Then send me the logs on the terminal running Django and also open the
>>>>> console and send the output,
>>>>>
>>>>> On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER <
>>>>> abubakarbr...@gmail.com> wrote:
>>>>>
>>>>>> okay let me explain.
>>>>>> I have trained models which tells us that which website is legitimate
>>>>>> or which website is not legitimate. I have integrated that model with my
>>>>>> django web app using rest api.
>>>>>> I tested the API on postman and working.
>>>>>> now I want to get the result on front end using HTML CSS and
>>>>>> javascript. so how can I achieve it?
>>>>>>
>>>>>> On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
>>>>>> duncansantiag...@gmail.com> wrote:
>>>>>>
>>>>>>> hello, am not sure what the question is. Kindly elaborate.
>>>>>>>
>>>>>>> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER <
>>>>>>> abubakarbr...@gmail.com> wrote:
>>>>>>>
>>>>>>>> I am working on a django based project in which I have integrated
>>>>>>>> ML trained models to check if a https url is legitimate or not. for 
>>>>>>>> this I
>>>>>>>> need javascript or ajax to call a rest api for my form in which I want 
>>>>>>>> to
>>>>>>>> send a post request so that I can check if a https url is legitimate 
>>>>>>>> or not.
>>>>>>>> *NOTE: My code is running successfully and giving correct answers
>>>>>>>> on postman.* so just want to integrate it with my HTML form.
>>>>>>>> *My work:*
>>>>>>>> *form.html:*
>>>>>>>> 
>>>>>>>> 
>>>>>>>>   
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>>
>>>>>>>> 
>>>>>>>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css&qu

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread DJANGO DEVELOPER
can I have you on anydesk or any meeting tool?

On Tue, Nov 23, 2021 at 11:31 PM Duncan Santiago 
wrote:

> send me your code then,
> or GitHub repo handle.
>
> On Tue, 23 Nov 2021 at 11:27, DJANGO DEVELOPER 
> wrote:
>
>> sorry if you get offended because I need a solution. a working solution.
>> I am not familiar with javascript. so getting a lot of issues
>>
>> On Tue, Nov 23, 2021 at 10:38 PM Duncan Santiago <
>> duncansantiag...@gmail.com> wrote:
>>
>>> your page also reloads and results may not be displayed on your
>>> frontend, just add this lines on your onclick listerner
>>>
>>> function(e){ //notice the e parameter, it is the event parameter.
>>> e.preventDefault()
>>>  your code here.
>>>
>>> }
>>>
>>> or you can just paste this on your script section
>>>
>>>
>>> (function () {
>>> var output = document.getElementById('output');
>>> document.getElementById('post').onclick = function (e) {
>>> e.preventDefault()
>>>   var data = document.getElementById('data').value;
>>>
>>>   axios.post('http://127.0.0.1:8000/predict/', JSON.parse(data))
>>> .then(function (res) {
>>>   output.className = 'container';
>>>   output.innerHTML = res.data;
>>> })
>>> .catch(function (err) {
>>>   output.className = 'container text-danger';
>>>   output.innerHTML = err.message;
>>> });
>>> };
>>>   })();
>>>
>>> On Tue, 23 Nov 2021 at 10:34, Duncan Santiago <
>>> duncansantiag...@gmail.com> wrote:
>>>
>>>> do a demo, enter the URL on the text area and click on the post button.
>>>> Then send me the logs on the terminal running Django and also open the
>>>> console and send the output,
>>>>
>>>> On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER 
>>>> wrote:
>>>>
>>>>> okay let me explain.
>>>>> I have trained models which tells us that which website is legitimate
>>>>> or which website is not legitimate. I have integrated that model with my
>>>>> django web app using rest api.
>>>>> I tested the API on postman and working.
>>>>> now I want to get the result on front end using HTML CSS and
>>>>> javascript. so how can I achieve it?
>>>>>
>>>>> On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
>>>>> duncansantiag...@gmail.com> wrote:
>>>>>
>>>>>> hello, am not sure what the question is. Kindly elaborate.
>>>>>>
>>>>>> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER <
>>>>>> abubakarbr...@gmail.com> wrote:
>>>>>>
>>>>>>> I am working on a django based project in which I have integrated ML
>>>>>>> trained models to check if a https url is legitimate or not. for this I
>>>>>>> need javascript or ajax to call a rest api for my form in which I want 
>>>>>>> to
>>>>>>> send a post request so that I can check if a https url is legitimate or 
>>>>>>> not.
>>>>>>> *NOTE: My code is running successfully and giving correct answers on
>>>>>>> postman.* so just want to integrate it with my HTML form.
>>>>>>> *My work:*
>>>>>>> *form.html:*
>>>>>>> 
>>>>>>> 
>>>>>>>   
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>>
>>>>>>> 
>>>>>>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
>>>>>>> rel="stylesheet"
>>>>>>> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
>>>>>>> crossorigin="anonymous">
>>>>>>>
>>>>>>> SITE URL Form
>>>>>>>   
>>>>>>>   
>>>>>>>   
>>>>>>>   
>>>>>>> SITE URL
>>>>>>> 
>>>>>>>   
>>>>>>>   POST
>&

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread Duncan Santiago
send me your code then,
or GitHub repo handle.

On Tue, 23 Nov 2021 at 11:27, DJANGO DEVELOPER 
wrote:

> sorry if you get offended because I need a solution. a working solution. I
> am not familiar with javascript. so getting a lot of issues
>
> On Tue, Nov 23, 2021 at 10:38 PM Duncan Santiago <
> duncansantiag...@gmail.com> wrote:
>
>> your page also reloads and results may not be displayed on your frontend,
>> just add this lines on your onclick listerner
>>
>> function(e){ //notice the e parameter, it is the event parameter.
>> e.preventDefault()
>>  your code here.
>>
>> }
>>
>> or you can just paste this on your script section
>>
>>
>> (function () {
>> var output = document.getElementById('output');
>> document.getElementById('post').onclick = function (e) {
>> e.preventDefault()
>>   var data = document.getElementById('data').value;
>>
>>   axios.post('http://127.0.0.1:8000/predict/', JSON.parse(data))
>> .then(function (res) {
>>   output.className = 'container';
>>   output.innerHTML = res.data;
>> })
>> .catch(function (err) {
>>   output.className = 'container text-danger';
>>   output.innerHTML = err.message;
>> });
>> };
>>   })();
>>
>> On Tue, 23 Nov 2021 at 10:34, Duncan Santiago 
>> wrote:
>>
>>> do a demo, enter the URL on the text area and click on the post button.
>>> Then send me the logs on the terminal running Django and also open the
>>> console and send the output,
>>>
>>> On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER 
>>> wrote:
>>>
>>>> okay let me explain.
>>>> I have trained models which tells us that which website is legitimate
>>>> or which website is not legitimate. I have integrated that model with my
>>>> django web app using rest api.
>>>> I tested the API on postman and working.
>>>> now I want to get the result on front end using HTML CSS and
>>>> javascript. so how can I achieve it?
>>>>
>>>> On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
>>>> duncansantiag...@gmail.com> wrote:
>>>>
>>>>> hello, am not sure what the question is. Kindly elaborate.
>>>>>
>>>>> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER <
>>>>> abubakarbr...@gmail.com> wrote:
>>>>>
>>>>>> I am working on a django based project in which I have integrated ML
>>>>>> trained models to check if a https url is legitimate or not. for this I
>>>>>> need javascript or ajax to call a rest api for my form in which I want to
>>>>>> send a post request so that I can check if a https url is legitimate or 
>>>>>> not.
>>>>>> *NOTE: My code is running successfully and giving correct answers on
>>>>>> postman.* so just want to integrate it with my HTML form.
>>>>>> *My work:*
>>>>>> *form.html:*
>>>>>> 
>>>>>> 
>>>>>>   
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>
>>>>>> 
>>>>>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
>>>>>> rel="stylesheet"
>>>>>> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
>>>>>> crossorigin="anonymous">
>>>>>>
>>>>>> SITE URL Form
>>>>>>   
>>>>>>   
>>>>>>   
>>>>>>   
>>>>>> SITE URL
>>>>>> 
>>>>>>   
>>>>>>   POST
>>>>>> 
>>>>>>
>>>>>> 
>>>>>>
>>>>>> 
>>>>>> 
>>>>>>   (function () {
>>>>>> var output = document.getElementById('output');
>>>>>> document.getElementById('post').onclick = function () {
>>>>>>   var data = document.getElementById('data').value;
>>>>>>
>>>>>>   axios.post('

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread DJANGO DEVELOPER
sorry if you get offended because I need a solution. a working solution. I
am not familiar with javascript. so getting a lot of issues

On Tue, Nov 23, 2021 at 10:38 PM Duncan Santiago 
wrote:

> your page also reloads and results may not be displayed on your frontend,
> just add this lines on your onclick listerner
>
> function(e){ //notice the e parameter, it is the event parameter.
> e.preventDefault()
>  your code here.
>
> }
>
> or you can just paste this on your script section
>
>
> (function () {
> var output = document.getElementById('output');
> document.getElementById('post').onclick = function (e) {
> e.preventDefault()
>   var data = document.getElementById('data').value;
>
>   axios.post('http://127.0.0.1:8000/predict/', JSON.parse(data))
> .then(function (res) {
>   output.className = 'container';
>   output.innerHTML = res.data;
> })
> .catch(function (err) {
>   output.className = 'container text-danger';
>   output.innerHTML = err.message;
> });
> };
>   })();
>
> On Tue, 23 Nov 2021 at 10:34, Duncan Santiago 
> wrote:
>
>> do a demo, enter the URL on the text area and click on the post button.
>> Then send me the logs on the terminal running Django and also open the
>> console and send the output,
>>
>> On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER 
>> wrote:
>>
>>> okay let me explain.
>>> I have trained models which tells us that which website is legitimate or
>>> which website is not legitimate. I have integrated that model with my
>>> django web app using rest api.
>>> I tested the API on postman and working.
>>> now I want to get the result on front end using HTML CSS and javascript.
>>> so how can I achieve it?
>>>
>>> On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
>>> duncansantiag...@gmail.com> wrote:
>>>
>>>> hello, am not sure what the question is. Kindly elaborate.
>>>>
>>>> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER 
>>>> wrote:
>>>>
>>>>> I am working on a django based project in which I have integrated ML
>>>>> trained models to check if a https url is legitimate or not. for this I
>>>>> need javascript or ajax to call a rest api for my form in which I want to
>>>>> send a post request so that I can check if a https url is legitimate or 
>>>>> not.
>>>>> *NOTE: My code is running successfully and giving correct answers on
>>>>> postman.* so just want to integrate it with my HTML form.
>>>>> *My work:*
>>>>> *form.html:*
>>>>> 
>>>>> 
>>>>>   
>>>>> 
>>>>> 
>>>>> 
>>>>>
>>>>> 
>>>>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
>>>>> rel="stylesheet"
>>>>> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
>>>>> crossorigin="anonymous">
>>>>>
>>>>> SITE URL Form
>>>>>   
>>>>>   
>>>>>   
>>>>>   
>>>>> SITE URL
>>>>> 
>>>>>   
>>>>>   POST
>>>>> 
>>>>>
>>>>> 
>>>>>
>>>>> 
>>>>> 
>>>>>   (function () {
>>>>> var output = document.getElementById('output');
>>>>> document.getElementById('post').onclick = function () {
>>>>>   var data = document.getElementById('data').value;
>>>>>
>>>>>   axios.post('<a  rel="nofollow" href="http://127.0.0.1:8000/predict/">http://127.0.0.1:8000/predict/</a>',
>>>>> JSON.parse(data))
>>>>> .then(function (res) {
>>>>>   output.className = 'container';
>>>>>   output.innerHTML = res.data;
>>>>> })
>>>>> .catch(function (err) {
>>>>>   output.className = 'container text-danger';
>>>>>   

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread Duncan Santiago
your page also reloads and results may not be displayed on your frontend,
just add this lines on your onclick listerner

function(e){ //notice the e parameter, it is the event parameter.
e.preventDefault()
 your code here.

}

or you can just paste this on your script section


(function () {
var output = document.getElementById('output');
document.getElementById('post').onclick = function (e) {
e.preventDefault()
  var data = document.getElementById('data').value;

  axios.post('http://127.0.0.1:8000/predict/', JSON.parse(data))
.then(function (res) {
  output.className = 'container';
  output.innerHTML = res.data;
})
.catch(function (err) {
  output.className = 'container text-danger';
  output.innerHTML = err.message;
});
};
  })();

On Tue, 23 Nov 2021 at 10:34, Duncan Santiago 
wrote:

> do a demo, enter the URL on the text area and click on the post button.
> Then send me the logs on the terminal running Django and also open the
> console and send the output,
>
> On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER 
> wrote:
>
>> okay let me explain.
>> I have trained models which tells us that which website is legitimate or
>> which website is not legitimate. I have integrated that model with my
>> django web app using rest api.
>> I tested the API on postman and working.
>> now I want to get the result on front end using HTML CSS and javascript.
>> so how can I achieve it?
>>
>> On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
>> duncansantiag...@gmail.com> wrote:
>>
>>> hello, am not sure what the question is. Kindly elaborate.
>>>
>>> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER 
>>> wrote:
>>>
>>>> I am working on a django based project in which I have integrated ML
>>>> trained models to check if a https url is legitimate or not. for this I
>>>> need javascript or ajax to call a rest api for my form in which I want to
>>>> send a post request so that I can check if a https url is legitimate or 
>>>> not.
>>>> *NOTE: My code is running successfully and giving correct answers on
>>>> postman.* so just want to integrate it with my HTML form.
>>>> *My work:*
>>>> *form.html:*
>>>> 
>>>> 
>>>>   
>>>> 
>>>> 
>>>> 
>>>>
>>>> 
>>>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
>>>> rel="stylesheet"
>>>> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
>>>> crossorigin="anonymous">
>>>>
>>>> SITE URL Form
>>>>   
>>>>   
>>>>   
>>>>   
>>>> SITE URL
>>>> 
>>>>   
>>>>   POST
>>>> 
>>>>
>>>> 
>>>>
>>>> 
>>>> 
>>>>   (function () {
>>>> var output = document.getElementById('output');
>>>> document.getElementById('post').onclick = function () {
>>>>   var data = document.getElementById('data').value;
>>>>
>>>>   axios.post('<a  rel="nofollow" href="http://127.0.0.1:8000/predict/">http://127.0.0.1:8000/predict/</a>',
>>>> JSON.parse(data))
>>>> .then(function (res) {
>>>>   output.className = 'container';
>>>>   output.innerHTML = res.data;
>>>> })
>>>> .catch(function (err) {
>>>>   output.className = 'container text-danger';
>>>>   output.innerHTML = err.message;
>>>> });
>>>> };
>>>>   })();
>>>> 
>>>>
>>>> 
>>>>
>>>> 
>>>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"</a>;
>>>> integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
>>>> crossorigin="anonymous">
>>>>
>>>> 
>>>> 
>>>>   
>>>> 
>>>>
>>>> *myapp/urls.py

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread Duncan Santiago
do a demo, enter the URL on the text area and click on the post button.
Then send me the logs on the terminal running Django and also open the
console and send the output,

On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER 
wrote:

> okay let me explain.
> I have trained models which tells us that which website is legitimate or
> which website is not legitimate. I have integrated that model with my
> django web app using rest api.
> I tested the API on postman and working.
> now I want to get the result on front end using HTML CSS and javascript.
> so how can I achieve it?
>
> On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
> duncansantiag...@gmail.com> wrote:
>
>> hello, am not sure what the question is. Kindly elaborate.
>>
>> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER 
>> wrote:
>>
>>> I am working on a django based project in which I have integrated ML
>>> trained models to check if a https url is legitimate or not. for this I
>>> need javascript or ajax to call a rest api for my form in which I want to
>>> send a post request so that I can check if a https url is legitimate or not.
>>> *NOTE: My code is running successfully and giving correct answers on
>>> postman.* so just want to integrate it with my HTML form.
>>> *My work:*
>>> *form.html:*
>>> 
>>> 
>>>   
>>> 
>>> 
>>> 
>>>
>>> 
>>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
>>> rel="stylesheet"
>>> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
>>> crossorigin="anonymous">
>>>
>>> SITE URL Form
>>>   
>>>   
>>>   
>>>   
>>> SITE URL
>>> 
>>>   
>>>   POST
>>> 
>>>
>>> 
>>>
>>> 
>>> 
>>>   (function () {
>>> var output = document.getElementById('output');
>>> document.getElementById('post').onclick = function () {
>>>   var data = document.getElementById('data').value;
>>>
>>>   axios.post('<a  rel="nofollow" href="http://127.0.0.1:8000/predict/">http://127.0.0.1:8000/predict/</a>', JSON.parse(data))
>>> .then(function (res) {
>>>   output.className = 'container';
>>>   output.innerHTML = res.data;
>>> })
>>> .catch(function (err) {
>>>   output.className = 'container text-danger';
>>>   output.innerHTML = err.message;
>>> });
>>> };
>>>   })();
>>> 
>>>
>>> 
>>>
>>> 
>>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"</a>;
>>> integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
>>> crossorigin="anonymous">
>>>
>>> 
>>> 
>>>   
>>> 
>>>
>>> *myapp/urls.py:*
>>> path('form/', form, name="form"),
>>> path('predict/', predict, name='predict')
>>> *this is the response I am returning:*
>>> if list(model.predict([test]))[0] == 1:
>>> return JsonResponse({"Response":"Legitimate"})
>>> else:
>>> return JsonResponse({"Response":"Phishing or fake"})
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/e81cf4f0-1208-4623-97f9-4b88f01d67b3n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/e81cf4f0-1208-4623-97f9-4b88f01d67b3n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To v

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread DJANGO DEVELOPER
okay let me explain.
I have trained models which tells us that which website is legitimate or
which website is not legitimate. I have integrated that model with my
django web app using rest api.
I tested the API on postman and working.
now I want to get the result on front end using HTML CSS and javascript. so
how can I achieve it?

On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago 
wrote:

> hello, am not sure what the question is. Kindly elaborate.
>
> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER 
> wrote:
>
>> I am working on a django based project in which I have integrated ML
>> trained models to check if a https url is legitimate or not. for this I
>> need javascript or ajax to call a rest api for my form in which I want to
>> send a post request so that I can check if a https url is legitimate or not.
>> *NOTE: My code is running successfully and giving correct answers on
>> postman.* so just want to integrate it with my HTML form.
>> *My work:*
>> *form.html:*
>> 
>> 
>>   
>> 
>> 
>> 
>>
>> 
>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
>> rel="stylesheet"
>> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
>> crossorigin="anonymous">
>>
>> SITE URL Form
>>   
>>   
>>   
>>   
>> SITE URL
>> 
>>   
>>   POST
>> 
>>
>> 
>>
>> 
>> 
>>   (function () {
>> var output = document.getElementById('output');
>> document.getElementById('post').onclick = function () {
>>   var data = document.getElementById('data').value;
>>
>>   axios.post('<a  rel="nofollow" href="http://127.0.0.1:8000/predict/">http://127.0.0.1:8000/predict/</a>', JSON.parse(data))
>> .then(function (res) {
>>   output.className = 'container';
>>   output.innerHTML = res.data;
>> })
>> .catch(function (err) {
>>   output.className = 'container text-danger';
>>   output.innerHTML = err.message;
>> });
>> };
>>   })();
>> 
>>
>> 
>>
>> 
>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"</a>;
>> integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
>> crossorigin="anonymous">
>>
>> 
>> 
>>   
>> 
>>
>> *myapp/urls.py:*
>> path('form/', form, name="form"),
>> path('predict/', predict, name='predict')
>> *this is the response I am returning:*
>> if list(model.predict([test]))[0] == 1:
>> return JsonResponse({"Response":"Legitimate"})
>> else:
>> return JsonResponse({"Response":"Phishing or fake"})
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/e81cf4f0-1208-4623-97f9-4b88f01d67b3n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/e81cf4f0-1208-4623-97f9-4b88f01d67b3n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACPcFdJ11YDrrpcCChwMcufz4CqcySacbKVQ-OtvEAVZEhK%3DBg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACPcFdJ11YDrrpcCChwMcufz4CqcySacbKVQ-OtvEAVZEhK%3DBg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKPY9pnmOXaLFnBRE4Eqi52yY-E%2BP1ih7arBDbxCqru4a-ZXxA%40mail.gmail.com.


Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread Duncan Santiago
hello, am not sure what the question is. Kindly elaborate.

On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER 
wrote:

> I am working on a django based project in which I have integrated ML
> trained models to check if a https url is legitimate or not. for this I
> need javascript or ajax to call a rest api for my form in which I want to
> send a post request so that I can check if a https url is legitimate or not.
> *NOTE: My code is running successfully and giving correct answers on
> postman.* so just want to integrate it with my HTML form.
> *My work:*
> *form.html:*
> 
> 
>   
> 
> 
> 
>
> 
> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
> rel="stylesheet"
> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
> crossorigin="anonymous">
>
> SITE URL Form
>   
>   
>   
>   
> SITE URL
> 
>   
>   POST
> 
>
> 
>
> 
> 
>   (function () {
> var output = document.getElementById('output');
> document.getElementById('post').onclick = function () {
>   var data = document.getElementById('data').value;
>
>   axios.post('<a  rel="nofollow" href="http://127.0.0.1:8000/predict/">http://127.0.0.1:8000/predict/</a>', JSON.parse(data))
> .then(function (res) {
>   output.className = 'container';
>   output.innerHTML = res.data;
> })
> .catch(function (err) {
>   output.className = 'container text-danger';
>   output.innerHTML = err.message;
> });
> };
>   })();
> 
>
> 
>
> 
> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"</a>;
> integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
> crossorigin="anonymous">
>
> 
> 
>   
> 
>
> *myapp/urls.py:*
> path('form/', form, name="form"),
> path('predict/', predict, name='predict')
> *this is the response I am returning:*
> if list(model.predict([test]))[0] == 1:
> return JsonResponse({"Response":"Legitimate"})
> else:
> return JsonResponse({"Response":"Phishing or fake"})
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e81cf4f0-1208-4623-97f9-4b88f01d67b3n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e81cf4f0-1208-4623-97f9-4b88f01d67b3n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACPcFdJ11YDrrpcCChwMcufz4CqcySacbKVQ-OtvEAVZEhK%3DBg%40mail.gmail.com.


AJAX or Javascript POST request for Django form

2021-11-23 Thread DJANGO DEVELOPER
I am working on a django based project in which I have integrated ML 
trained models to check if a https url is legitimate or not. for this I 
need javascript or ajax to call a rest api for my form in which I want to 
send a post request so that I can check if a https url is legitimate or not.
*NOTE: My code is running successfully and giving correct answers on 
postman.* so just want to integrate it with my HTML form.
*My work:*
*form.html:*


  





https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"; 
rel="stylesheet" 
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
 
crossorigin="anonymous">

SITE URL Form
  
  
  
  
SITE URL

  
  POST






  (function () {
var output = document.getElementById('output');
document.getElementById('post').onclick = function () {
  var data = document.getElementById('data').value;

  axios.post('<a  rel="nofollow" href="http://127.0.0.1:8000/predict/">http://127.0.0.1:8000/predict/</a>', JSON.parse(data))
.then(function (res) {
  output.className = 'container';
  output.innerHTML = res.data;
})
.catch(function (err) {
  output.className = 'container text-danger';
  output.innerHTML = err.message;
});
};
  })();





https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"</a>;
 
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
 
crossorigin="anonymous">



  


*myapp/urls.py:*
path('form/', form, name="form"),
path('predict/', predict, name='predict')
*this is the response I am returning:*
if list(model.predict([test]))[0] == 1:
return JsonResponse({"Response":"Legitimate"})
else:
return JsonResponse({"Response":"Phishing or fake"})

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e81cf4f0-1208-4623-97f9-4b88f01d67b3n%40googlegroups.com.


Quit the server with CTRL-BREAK. code 400, message Bad request version ('ÚÚ\x13\x01\x13\x02\x13\x03À+À/

2021-09-29 Thread emmanuel odor
Hi ,

I keep having this error whenever i run the python manage.py runserver

Django version 3.2.7, using settings 'crm.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK. code 400, message Bad request version
('ÚÚ\x13\x01\x13\x02\x13\x03À+À/À,À0̨̩À\x13À\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x01\x93ZZ\x00\x00\x00\x17\x00\x00ÿ\x01\x
00\x01\x00\x00')
[29/Sep/2021 18:35:04] You're accessing the development server over HTTPS,
but it only supports HTTP.

[29/Sep/2021 18:35:04] code 400, message Bad request version
('\x9a\x9a\x13\x01\x13\x02\x13\x03À+À/À,À0̨̩À\x13À\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x01\x93ZZ\x00\x00\x00\x17\x00\x00ÿ
\x01\x00\x01\x00\x00')
[29/Sep/2021 18:35:04] You're accessing the development server over HTTPS,
but it only supports HTTP.

*Emmanuel Odor*

Phone: *+234-7037-411553* <+234-7037-411553>
Mobile: *+234-9 <+234-8093-910965>055511066*
Skype: *Emmanuel Odo <https://mail.google.com/mail/u/0/>r
 *
24 Bajulaiye  Road, Shomolu,
Lagos State.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF54d_2Mi%2BUPRnK%2BJSRj9M0hK8YA%2B%3D2RDv5%3DVxrczZKeGaQCDg%40mail.gmail.com.


Re: Surpress Daphne request logging levels

2021-08-23 Thread Jason
daphene runs at the same infra layer level as uwsgi/gunicorn so you need to 
define the log level at process init.  Django has no control over this.

On Friday, August 20, 2021 at 12:05:17 PM UTC-4 benny.s...@gmail.com wrote:

> I am trying to surpress the log output from daphne.
>
> example log:
>
> Aug 20 08:33:53 admin daphne[663290]: 127.0.0.1:35638 - - 
> [20/Aug/2021:08:33:50] "PATCH /api/v1/worker/59/" 200 168
>
> logger  'django.request'  seem to have no effect on it.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/97bb1d13-d536-4fab-94a4-158b40e83927n%40googlegroups.com.


Surpress Daphne request logging levels

2021-08-20 Thread Skullb0ne
I am trying to surpress the log output from daphne.

example log:

Aug 20 08:33:53 admin daphne[663290]: 127.0.0.1:35638 - - 
[20/Aug/2021:08:33:50] "PATCH /api/v1/worker/59/" 200 168

logger  'django.request'  seem to have no effect on it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/261d55f6-9a11-43d6-85d2-bf1c5503d887n%40googlegroups.com.


Feature request for django permissions

2021-06-12 Thread wael muhammed

I have a projects with multi branches . I want to make permissions 
according to branch record.
I couldn't add customize django permissions model to make foreign key  from 
branch model.
Look here 

 
for more details

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/41fd6fb3-920a-4ba7-8c2e-d2216793b83dn%40googlegroups.com.


Re: In immediate help of a long time pending request, kindly help.

2021-06-04 Thread Aritra Ray
Hello

I tried this but I'm still seeing the list of cart items. Can you tell me
where I am going wrong?

Regards,
Aritra

On Tue, 1 Jun 2021 at 21:23, Joel Tanko <7thog...@gmail.com> wrote:

> If you want to show the items relative to the currently logged in user,
> try adding this option => limit_choices_to={'user' : 'user'}, to your items
> field in models.py
>
>
>
> On Tuesday, 1 June 2021, Aritra Ray  wrote:
>
>> Right, thank you so much.
>>
>> Regards.
>>
>> On Tue, 1 Jun, 2021, 8:27 pm oba stephen,  wrote:
>>
>>> You should return this if you want to redirect to cart;
>>>
>>> return redirect(reverse("store:cart-page", kwargs={"id": >> cart>}))
>>>
>>> Best regards
>>>
>>> Stephen Oba
>>>
>>> On Tue, Jun 1, 2021, 3:27 PM Aritra Ray  wrote:
>>>
 Sure, here's the file.

 [image: 2021-06-01 (6).png]

 Regards,
 Aritra.

 On Tue, 1 Jun 2021 at 19:45, oba stephen  wrote:

> Can I see your urls.py?
>
> Best regards
>
> Stephen Oba
>
> On Tue, Jun 1, 2021, 3:05 PM Aritra Ray  wrote:
>
>> Oh, okay. I was unaware of that. Although, my cart page is getting
>> redirected back to home page. Can you spot any mistake in the provided
>> screenshots?
>> Also, can you please guide on how to redirect a function to the
>> previously visited page? Like add-to-cart should redirect to either
>> products page or cart page itself depending on which page the user called
>> it from.
>>
>> On Tue, 1 Jun, 2021, 6:37 pm oba stephen, 
>> wrote:
>>
>>> Hi,
>>>
>>> I don't think you have an error here. Although I haven't looked at
>>> the code, but from your django admin page I can see that none of those
>>> items are selected.
>>>
>>> If you run a query from your terminal, you would notice that the
>>> items would return as empty.
>>>
>>> When you create a many to many relationship in django, all objects
>>> on that related model would display this way.
>>>
>>> What is the difference between different carts?  The difference is,
>>> the items would be selected or highlighted in a cart they belong to.
>>>
>>> Regards
>>>
>>> Best regards
>>>
>>> Stephen Oba
>>>
>>> On Tue, Jun 1, 2021, 1:52 PM Aritra Ray  wrote:
>>>

 Hello,
 This is Aritra reposting the same error. I have a problem regarding
 an E-commerce Django website where the cart model on the admin page is
 showing the items added to cart by one user to all other users as well.
 I have a Profile model and a Cart model attached below. The
 views.py has been attached too. Kindly comment back if anything else is
 needed.
 Thanks in advance.


 Regards,
 Aritra

 Error:

 [image: 2021-06-01 (4).png]

 Views.py

 [image: 2021-06-01 (1).png][image: 2021-06-01 (5).png]

 Models.py

 [image: 2021-06-01 (2).png][image: 2021-06-01 (3).png]

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it,
 send an email to django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAFecadtNZeLbatpdnuC_RUDdjLjbrvZTO%2BMVD7hPuHNkN%2Bv%2BBA%40mail.gmail.com
 
 .

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>> send an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAAJsLnpYBVfacxd3NJ7sqnC6dD2b6nBQw%3DFqfQe9Od1%2BpwTHww%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFecadvZ11v-bvZzCXUVUTpr0WBa6eVmF7M6qpoVRFNF5dS%2Bcg%40mail.gmail.com
>> 
>> .
>>
>>

Re: In immediate help of a long time pending request, kindly help.

2021-06-01 Thread Aritra Ray
Right, will try and let you know.

On Tue, 1 Jun, 2021, 9:23 pm Joel Tanko, <7thog...@gmail.com> wrote:

> If you want to show the items relative to the currently logged in user,
> try adding this option => limit_choices_to={'user' : 'user'}, to your items
> field in models.py
>
>
>
> On Tuesday, 1 June 2021, Aritra Ray  wrote:
>
>> Right, thank you so much.
>>
>> Regards.
>>
>> On Tue, 1 Jun, 2021, 8:27 pm oba stephen,  wrote:
>>
>>> You should return this if you want to redirect to cart;
>>>
>>> return redirect(reverse("store:cart-page", kwargs={"id": >> cart>}))
>>>
>>> Best regards
>>>
>>> Stephen Oba
>>>
>>> On Tue, Jun 1, 2021, 3:27 PM Aritra Ray  wrote:
>>>
 Sure, here's the file.

 [image: 2021-06-01 (6).png]

 Regards,
 Aritra.

 On Tue, 1 Jun 2021 at 19:45, oba stephen  wrote:

> Can I see your urls.py?
>
> Best regards
>
> Stephen Oba
>
> On Tue, Jun 1, 2021, 3:05 PM Aritra Ray  wrote:
>
>> Oh, okay. I was unaware of that. Although, my cart page is getting
>> redirected back to home page. Can you spot any mistake in the provided
>> screenshots?
>> Also, can you please guide on how to redirect a function to the
>> previously visited page? Like add-to-cart should redirect to either
>> products page or cart page itself depending on which page the user called
>> it from.
>>
>> On Tue, 1 Jun, 2021, 6:37 pm oba stephen, 
>> wrote:
>>
>>> Hi,
>>>
>>> I don't think you have an error here. Although I haven't looked at
>>> the code, but from your django admin page I can see that none of those
>>> items are selected.
>>>
>>> If you run a query from your terminal, you would notice that the
>>> items would return as empty.
>>>
>>> When you create a many to many relationship in django, all objects
>>> on that related model would display this way.
>>>
>>> What is the difference between different carts?  The difference is,
>>> the items would be selected or highlighted in a cart they belong to.
>>>
>>> Regards
>>>
>>> Best regards
>>>
>>> Stephen Oba
>>>
>>> On Tue, Jun 1, 2021, 1:52 PM Aritra Ray  wrote:
>>>

 Hello,
 This is Aritra reposting the same error. I have a problem regarding
 an E-commerce Django website where the cart model on the admin page is
 showing the items added to cart by one user to all other users as well.
 I have a Profile model and a Cart model attached below. The
 views.py has been attached too. Kindly comment back if anything else is
 needed.
 Thanks in advance.


 Regards,
 Aritra

 Error:

 [image: 2021-06-01 (4).png]

 Views.py

 [image: 2021-06-01 (1).png][image: 2021-06-01 (5).png]

 Models.py

 [image: 2021-06-01 (2).png][image: 2021-06-01 (3).png]

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it,
 send an email to django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAFecadtNZeLbatpdnuC_RUDdjLjbrvZTO%2BMVD7hPuHNkN%2Bv%2BBA%40mail.gmail.com
 
 .

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>> send an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAAJsLnpYBVfacxd3NJ7sqnC6dD2b6nBQw%3DFqfQe9Od1%2BpwTHww%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFecadvZ11v-bvZzCXUVUTpr0WBa6eVmF7M6qpoVRFNF5dS%2Bcg%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google
> G

In immediate help of a long time pending request, kindly help.

2021-06-01 Thread Joel Tanko
If you want to show the items relative to the currently logged in user, try
adding this option => limit_choices_to={'user' : 'user'}, to your items
field in models.py



On Tuesday, 1 June 2021, Aritra Ray  wrote:

> Right, thank you so much.
>
> Regards.
>
> On Tue, 1 Jun, 2021, 8:27 pm oba stephen,  wrote:
>
>> You should return this if you want to redirect to cart;
>>
>> return redirect(reverse("store:cart-page", kwargs={"id": > cart>}))
>>
>> Best regards
>>
>> Stephen Oba
>>
>> On Tue, Jun 1, 2021, 3:27 PM Aritra Ray  wrote:
>>
>>> Sure, here's the file.
>>>
>>> [image: 2021-06-01 (6).png]
>>>
>>> Regards,
>>> Aritra.
>>>
>>> On Tue, 1 Jun 2021 at 19:45, oba stephen  wrote:
>>>
 Can I see your urls.py?

 Best regards

 Stephen Oba

 On Tue, Jun 1, 2021, 3:05 PM Aritra Ray  wrote:

> Oh, okay. I was unaware of that. Although, my cart page is getting
> redirected back to home page. Can you spot any mistake in the provided
> screenshots?
> Also, can you please guide on how to redirect a function to the
> previously visited page? Like add-to-cart should redirect to either
> products page or cart page itself depending on which page the user called
> it from.
>
> On Tue, 1 Jun, 2021, 6:37 pm oba stephen, 
> wrote:
>
>> Hi,
>>
>> I don't think you have an error here. Although I haven't looked at
>> the code, but from your django admin page I can see that none of those
>> items are selected.
>>
>> If you run a query from your terminal, you would notice that the
>> items would return as empty.
>>
>> When you create a many to many relationship in django, all objects on
>> that related model would display this way.
>>
>> What is the difference between different carts?  The difference is,
>> the items would be selected or highlighted in a cart they belong to.
>>
>> Regards
>>
>> Best regards
>>
>> Stephen Oba
>>
>> On Tue, Jun 1, 2021, 1:52 PM Aritra Ray  wrote:
>>
>>>
>>> Hello,
>>> This is Aritra reposting the same error. I have a problem regarding
>>> an E-commerce Django website where the cart model on the admin page is
>>> showing the items added to cart by one user to all other users as well.
>>> I have a Profile model and a Cart model attached below. The views.py
>>> has been attached too. Kindly comment back if anything else is needed.
>>> Thanks in advance.
>>>
>>>
>>> Regards,
>>> Aritra
>>>
>>> Error:
>>>
>>> [image: 2021-06-01 (4).png]
>>>
>>> Views.py
>>>
>>> [image: 2021-06-01 (1).png][image: 2021-06-01 (5).png]
>>>
>>> Models.py
>>>
>>> [image: 2021-06-01 (2).png][image: 2021-06-01 (3).png]
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>> send an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAFecadtNZeLb
>>> atpdnuC_RUDdjLjbrvZTO%2BMVD7hPuHNkN%2Bv%2BBA%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAAJsLnpYBVfa
>> cxd3NJ7sqnC6dD2b6nBQw%3DFqfQe9Od1%2BpwTHww%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFecadvZ11v-
> bvZzCXUVUTpr0WBa6eVmF7M6qpoVRFNF5dS%2Bcg%40mail.gmail.com
> 
> .
>
 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit https://groups.goo

Re: Filtering fields in http response data from http request url ?

2021-05-31 Thread Sam Chaffy
Using django rest framework, create a serializer class and specify the
right field you want to display at the end.

Please check this link

https://www.django-rest-framework.org/api-guide/serializers/


On Sun, May 30, 2021 at 10:03 PM Mottaz Hegaze  wrote:

> Using Django Rest Framework , you can alter the output by overriting
> function to_represent in serializer.
>
> On Mon, 31 May 2021, 1:26 am Adaeit Telle, 
> wrote:
>
>> Hi Django Developers,
>> Json response from the django server is huge as the data fields contained
>> are of big size.
>> So, can I restrict the *fields* required in the response data from the
>> *HTTP Request Url* ?
>> Is there a generic param, which can be used ?
>>
>> Just like QuerySet, can we have "ValueSet" to restrict the fields(or
>> columns) in the json response data ?
>>
>> Regards,
>> Adaeit
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/f274b86b-e3fb-483b-802e-857362087619n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/f274b86b-e3fb-483b-802e-857362087619n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHV4E-dB0%3DHha6HgCoG4igdBbyyjPbQMO3rjkZBPaHH6_Kwscw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHV4E-dB0%3DHha6HgCoG4igdBbyyjPbQMO3rjkZBPaHH6_Kwscw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
-- 
Oussama Chafiqui

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPvcp%2BUVnw%2BncKDhkOA2dma%3Dd9bw%3DAtgjNy6cCcPZAxnZBVmOA%40mail.gmail.com.


  1   2   3   4   5   6   7   8   9   10   >