Questions tagged [django-request]

96 questions
0
votes
1 answer

What is the recommended way of passing parameters in Django request when its required in each request?

I have to pass two parameters in every Django Request to use them in a decorator which is being called on every view of my Django application. Currently, I am using the following way to pass parameters. class RoleTaskForm(forms.Form): task_id =…
RIO
  • 148
  • 1
  • 8
0
votes
1 answer

POST method not allowed in django requests

I'm trying to call an API using django request.post but getting error 405 'Method Not Allowed (POST)' urls: path('ciu_consume///', CiuConsumeView.as_view()) view: class CiuConsumeView(APIView): def dispatch(self, *args,…
chirag
  • 153
  • 2
  • 13
0
votes
2 answers

How can I get request data in Django from a redirect?

I need to get data from a redirect, but I can't really figure out how. The method is GET as I can see from my print. But I have tried everything I found on searching for this without luck. What am I doing wrong? I really appreciate any help. I have…
Peter
  • 43
  • 6
0
votes
0 answers

'str' object has no attribute 'user' error in Django

I have a view in Django and I have to call another function in this view. When i call the function in the view, the i got 'str' object has no attribute 'user' error. But when i delete the function call, there is no error. It gave the error in django…
Aslı Kök
  • 616
  • 8
  • 19
0
votes
2 answers

Django request.POST.get() returns None

I face a problem and I can't find a solution. I'm trying to redirect to the previous page after login. Somehow the ?next=request.path returns none when trying to request.POST.get() after submission. This is my Html code that directs the user to…
Nordin Sami
  • 1
  • 1
  • 1
  • 2
0
votes
0 answers

Unable to access request.session variable upon url callback in Django

I am trying to integrate Spotify Authorization flow (to gain access and refresh tokens) into my Django app. For this I have setup two Django endpoints - one for spotify login and another for spotify callback. The login endpoint redirects to the…
0
votes
0 answers

Logging User statistics in Django

I am using Django's auth_user model and wanted to log the user activities(accessed page details) in my table. I explored and figured out to use django-request module. I have installed django-request 1.5.2 for django 1.8 version. I'm getting this…
Santhosh
  • 83
  • 1
  • 8
0
votes
0 answers

Django unquote() with url parameters

I had used unquote in my urls before to get special characters in the url like so: path('example/', views.find_user_by_phone_number.as_view(), name='api.find_user_by_phone_number'), #call with example/+849323212231 and in my…
Linh Nguyen
  • 3,452
  • 4
  • 23
  • 67
0
votes
1 answer

Data added in Request session lost when using HttpResponseRedirect between views

I have an API, in which if the user is not permitted to access it, am redirecting it to another view along with a user message adding to request session and using that info am using django message framework to display the message in templates. In…
gagana
  • 73
  • 1
  • 1
  • 6
0
votes
1 answer

I'm trying to incorporate multiple models into a single django view; how can I access the context **kwargs

I've tried this: class MyClass(LoginRequiredMixin, UpdateView, ListView): model = models.my_model fields = ['first_model_field', 'second_model_field'] template_name = 'app/template_name.html' extra_context = {'second_model':…
0
votes
1 answer

Django how to use request data as form in an html template

I am using Django rest framework rest-auth for login and sign up. But I do not want to use the browseable API as my UI. I am building my own form. so I am using a custom login url like so: path('rest-auth/customlogin', CustomLoginView.as_view(),…
bcsta
  • 1,963
  • 3
  • 22
  • 61
0
votes
1 answer

s it possible to use request object outside of views or other way to get current user information

I want to operate some filter with user based. So I need logged user information in my admin.py or other file. But I don't understand how it possible to get current loged user id or other information. Any one help me? Example…
0
votes
1 answer

Error while accessing request.session['key'] inside forms. [using CheckboxSelectMultiple]

I have two forms named GoodAtForm and PaidForForm. What these do is as follows... GoodAtForm Takes an input from a list in request.session['love'] and presents it to the user. Then user is presented with a CheckboXSelectMultiple fields so that…
Deshwal
  • 3,436
  • 4
  • 35
  • 94
0
votes
1 answer

Django resend activation link, missing 1 required positional argument: 'user'

I have read similar questions but I cannot understand why this is not working. I am trying to send a reactivation email to user when they click on a link. The activation link is generated properly when the user signs up and the email is sent, but…
Naeem Khan
  • 950
  • 4
  • 13
  • 34
0
votes
1 answer

django) request.POST method gives me errror : querydict object is not callable

I'm trying to add social login to my django-rest-framework app, but I'm stuck on this problem and need some help. Login Flow: Request code(GET) -> Response -> Request token(POST)(This part is where I'm stuck) -> Response API reference here So, after…