Having just followed through the Part 5 of the official tutorial, I've run into a problem. The hyperlinked API works very well, expect when I click on a snippet. For instance, in the following:
HTTP 200 OK
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"url": "http://localhost:8000/snippets/1/",
"owner": "ankush",
"title": "",
"code": "print 123",
"linenos": false,
"language": "python",
"style": "friendly",
"highlight": "http://localhost:8000/snippets/1/highlight/"
}
]
}
clicking on the url gives me this exception: 'Snippet Serializer' object is not callable. I thought I had copied everything correctly from the tutorial, but apparently I hadn't. The code is here: https://github.com/ankush981/rest-demo
Finally, here's the entire trace:
Environment:
Request Method: GET
Request URL: http://localhost:8000/snippets/1/
Django Version: 1.9.7
Python Version: 3.4.3
Installed Applications:
('rest_framework',
'snippets',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware')
Traceback:
File "/media/common/code/python/django-rest/tutorial/env/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
149. response = self.process_exception_by_middleware(e, request)
File "/media/common/code/python/django-rest/tutorial/env/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
147. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/media/common/code/python/django-rest/tutorial/env/lib/python3.4/site-packages/django/views/decorators/csrf.py" in wrapped_view
58. return view_func(*args, **kwargs)
File "/media/common/code/python/django-rest/tutorial/env/lib/python3.4/site-packages/django/views/generic/base.py" in view
68. return self.dispatch(request, *args, **kwargs)
File "/media/common/code/python/django-rest/tutorial/env/lib/python3.4/site-packages/rest_framework/views.py" in dispatch
466. response = self.handle_exception(exc)
File "/media/common/code/python/django-rest/tutorial/env/lib/python3.4/site-packages/rest_framework/views.py" in dispatch
463. response = handler(request, *args, **kwargs)
File "/media/common/code/python/django-rest/tutorial/env/lib/python3.4/site-packages/rest_framework/generics.py" in get
286. return self.retrieve(request, *args, **kwargs)
File "/media/common/code/python/django-rest/tutorial/env/lib/python3.4/site-packages/rest_framework/mixins.py" in retrieve
57. serializer = self.get_serializer(instance)
File "/media/common/code/python/django-rest/tutorial/env/lib/python3.4/site-packages/rest_framework/generics.py" in get_serializer
111. return serializer_class(*args, **kwargs)
Exception Type: TypeError at /snippets/1/
Exception Value: 'SnippetSerializer' object is not callable
ok dear dotslash
i check that code :
Shouldn't this:
class SnippetDetail(generics.RetrieveUpdateDestroyAPIView):
'''Retrieve, update or delete a snippet'''
queryset = Snippet.objects.all()
serializer_class = SnippetSerializer()
permission_classes = (permissions.IsAuthenticatedOrReadOnly, IsOwnerOrReadOnly)
Be that:
class SnippetDetail(generics.RetrieveUpdateDestroyAPIView):
'''Retrieve, update or delete a snippet'''
queryset = Snippet.objects.all()
serializer_class = SnippetSerializer
permission_classes = (permissions.IsAuthenticatedOrReadOnly, IsOwnerOrReadOnly)
Related
I'm trying to set up proxy for scrapy-playwright but always get the error
playwright._impl._api_types.Error: net::ERR_TIMED_OUT at http://whatismyip.com/
=========================== logs ===========================
navigating to "http://whatismyip.com/", waiting until "load"
when executing the code:
from scrapy import Spider, Request
from scrapy_playwright.page import PageMethod
class ProxySpider(Spider):
name = "check_proxy_ip"
custom_settings = {
"PLAYWRIGHT_LAUNCH_OPTIONS": {
"proxy": {
"server": "http://host:port",
"username": "user",
"password": "pass",
},
},
"PLAYWRIGHT_DEFAULT_NAVIGATION_TIMEOUT": "300000",
}
def start_requests(self):
yield Request("http://whatismyip.com",
meta=dict(
playwright=True,
playwright_include_page=True,
playwright_page_methods=[PageMethod('wait_for_selector', 'span.ipv4-hero')]
),
callback=self.parse,
)
def parse(self, response):
print(response.text)
The proxies tried are paid and working as checked, and the DOWNLOAD_DELAY in settings.py is set to DOWNLOAD_DELAY=30. This happens whether PLAYWRIGHT_DEFAULT_NAVIGATION_TIMEOUT is set to 0, 10000, or 300000 (as copied in the code above). What is the problem here?
I'm stuck when trying to raise a validation error with FastAPI + GraphQL (graphene).
I have a resolver code:
class Query(graphene.ObjectType):
list_categories = graphene.List(CategoryGrapheneModel)
get_category = graphene.Field(CategoryGrapheneModel, id=graphene.Argument(graphene.Int, required=True))
#staticmethod
def resolve_list_categories(parent, info):
return Category.all()
#staticmethod
def resolve_get_category(parent, info, id):
try:
category = Category.find_or_fail(id)
return category
except ModelNotFound as ex:
raise Exception('Category not found')
But instead of getting 400 HTTP response with the message I got 500 Internal Server Error with traceback:
Traceback (most recent call last):
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 394, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
return await self.app(scope, receive, send)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/fastapi/applications.py", line 199, in __call__
await super().__call__(scope, receive, send)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/applications.py", line 111, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 181, in __call__
raise exc from None
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in __call__
await self.app(scope, receive, _send)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
raise exc from None
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in __call__
await self.app(scope, receive, sender)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/routing.py", line 566, in __call__
await route.handle(scope, receive, send)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/routing.py", line 227, in handle
await self.app(scope, receive, send)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/graphql.py", line 52, in __call__
response = await self.handle_graphql(request)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/graphql.py", line 105, in handle_graphql
[format_graphql_error(err) for err in result.errors]
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/graphql.py", line 105, in <listcomp>
[format_graphql_error(err) for err in result.errors]
TypeError: 'NoneType' object is not callable
Googling is not gives me a solution. So please help.
Got handled with it.
The problem was in GraphQLApp, there was calling format_graphql_errors that was undefined (None).
To solve a problem I've created a custom child class from GraphQLApp and changed format_graphql_errors to format_error from graphql.error.graphql_error package.
import json
import typing
from starlette.graphql import GraphQLApp
from starlette import status
from starlette.background import BackgroundTasks
from starlette.concurrency import run_in_threadpool
from starlette.requests import Request
from starlette.responses import HTMLResponse, JSONResponse, PlainTextResponse, Response
from starlette.types import Receive, Scope, Send
from graphql.error.graphql_error import format_error
class CustomGraphQLApp(GraphQLApp):
async def handle_graphql(self, request: Request) -> Response:
if request.method in ("GET", "HEAD"):
if "text/html" in request.headers.get("Accept", ""):
if not self.graphiql:
return PlainTextResponse(
"Not Found", status_code=status.HTTP_404_NOT_FOUND
)
return await self.handle_graphiql(request)
data = request.query_params # type: typing.Mapping[str, typing.Any]
elif request.method == "POST":
content_type = request.headers.get("Content-Type", "")
if "application/json" in content_type:
data = await request.json()
elif "application/graphql" in content_type:
body = await request.body()
text = body.decode()
data = {"query": text}
elif "query" in request.query_params:
data = request.query_params
else:
return PlainTextResponse(
"Unsupported Media Type",
status_code=status.HTTP_415_UNSUPPORTED_MEDIA_TYPE,
)
else:
return PlainTextResponse(
"Method Not Allowed", status_code=status.HTTP_405_METHOD_NOT_ALLOWED
)
try:
query = data["query"]
variables = data.get("variables")
operation_name = data.get("operationName")
except KeyError:
return PlainTextResponse(
"No GraphQL query found in the request",
status_code=status.HTTP_400_BAD_REQUEST,
)
background = BackgroundTasks()
context = {"request": request, "background": background}
result = await self.execute(
query, variables=variables, context=context, operation_name=operation_name
)
error_data = (
[format_error(err) for err in result.errors]
if result.errors
else None
)
response_data = {"data": result.data}
if error_data:
response_data["errors"] = error_data
status_code = (
status.HTTP_400_BAD_REQUEST if result.errors else status.HTTP_200_OK
)
return JSONResponse(
response_data, status_code=status_code, background=background
)
I hope this will help others.
Based on the great answer from #Vitaly Radchik, I created more universal and compressed code by redefining the existing handle_graphql after format_graphql_error is defined.
import json, typing, inspect
from starlette import status
from starlette.background import BackgroundTasks
from starlette.requests import Request
from starlette.responses import JSONResponse, PlainTextResponse, Response
from graphql.error.graphql_error import format_error as format_graphql_error
# Get source of `handle_graphql` function
code = inspect.getsource(GraphQLApp.handle_graphql).lstrip()
class CustomGraphQLApp(GraphQLApp):
# Redefine handle_graphql function
exec(code)
I am building a tartiflette app with FastApi using tartiflette-asgi and I can't find a way of making regular FastApi authentication or dependency injection work.
The problem lies in how the tartiflette app is built and mounted. When doing
app = FastApi()
gql_app = TartifletteApp(..)
app.mount("/graphql", gql_app)
I have no way of specifying dependencies to execute my headers validation. I've tried using FastApi include_router but it simply doesn't work with TartifletteApp. I have also tried a small hack like
gql_app = TartifletteApp(..)
app.include_router(
gql_app.router,
prefix="/graphql",
# dependencies=[Depends(get_current_user)], # here I would add a token and get a user
)
I get the error
File "/usr/local/lib/python3.6/site-packages/uvicorn/protocols/http/h11_impl.py", line 389, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.6/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/fastapi/applications.py", line 181, in __call__
await super().__call__(scope, receive, send) # pragma: no cover
File "/usr/local/lib/python3.6/site-packages/starlette/applications.py", line 111, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/starlette/middleware/errors.py", line 181, in __call__
raise exc from None
File "/usr/local/lib/python3.6/site-packages/starlette/middleware/errors.py", line 159, in __call__
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.6/site-packages/starlette/exceptions.py", line 82, in __call__
raise exc from None
File "/usr/local/lib/python3.6/site-packages/starlette/exceptions.py", line 71, in __call__
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.6/site-packages/starlette/routing.py", line 566, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/starlette/routing.py", line 227, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/tartiflette_asgi/_endpoints.py", line 84, in dispatch
graphiql = get_graphql_config(request).graphiql
File "/usr/local/lib/python3.6/site-packages/tartiflette_asgi/_middleware.py", line 18, in get_graphql_config
config = conn["graphql"]
File "/usr/local/lib/python3.6/site-packages/starlette/requests.py", line 68, in __getitem__
return self.scope[key]
KeyError: 'graphql'
I could implement the headers validation as a graphql middleware but I was hoping I could do it at theFastApi level so it applies to every endpoint.
Any suggestions on how to solve this?
Create a basic auth first, then add it to Dependencies instead of getting the current user this will add a Basic authentication to your endpoint
from fastapi.security import HTTPBasic, HTTPBasicCredentials
security = HTTPBasic()
app.include_router(
gql_app.router,
prefix="/graphql",
dependencies=[Depends(security)],
)
I have managed to solve this without tartiflette-asgi. The solution is posted here
It looks like:
import os
import json
import typing
from starlette.background import BackgroundTasks
from starlette.datastructures import QueryParams
from starlette.requests import Request
from starlette.responses import HTMLResponse, JSONResponse, PlainTextResponse, Response
from tartiflette import Engine
class GraphQLApp:
def __init__(self, app, modules, schema_path=None, error_coercer=None):
self.engine = Engine(
sdl=schema_path or os.path.join(os.path.dirname(__file__), "schema"),
modules=modules,
error_coercer=error_coercer,
)
app.on_event("startup")(self._cook)
async def _cook(self):
await self.engine.cook()
def _build_context(self, **kwargs):
return kwargs or {} # add custom logic when needed here
async def _get_response(self, request: Request, data: QueryParams, context: dict) -> Response:
try:
query = data["query"]
except KeyError:
return PlainTextResponse("No GraphQL query found in the request", 400)
def _format_error(error: typing.Any) -> dict:
import ast
try:
return ast.literal_eval(str(error))
except ValueError:
return {"message": "Internal Server Error"}
background = BackgroundTasks()
context = {"req": request, "background": background, **self._build_context(**context)}
result: dict = await self.engine.execute(
query,
context=context,
variables=data.get("variables"),
operation_name=data.get("operationName"),
)
content = {"data": result["data"]}
has_errors = "errors" in result
if has_errors:
content["errors"] = [_format_error(error) for error in result["errors"]]
status = 400 if has_errors else 200
return JSONResponse(content=content, status_code=status, background=background)
async def process_request(self, request: Request, context: dict = None) -> Response:
content_type = request.headers.get("Content-Type", "")
if "application/json" in content_type:
try:
data = await request.json()
except json.JSONDecodeError:
return JSONResponse({"error": "Invalid JSON."}, 400)
elif "application/graphql" in content_type:
body = await request.body()
data = {"query": body.decode()}
elif "query" in request.query_params:
data = request.query_params
else:
return PlainTextResponse("Unsupported Media Type", 415)
return await self._get_response(request, data=data, context=context or {})
So I can just do
app = FastApi()
gql_app = GraphQLApp(app)
#app.post("/graphql")
async def graphql_ninja(request: Request):
return await gql_app.process_request(request)
The Django Rest Framework exception handler doesn't seem to be working for me. ValidationErrors are getting turned into 500 responses.
When a ValidationError is raised, it doesn't get converted into a 400.
Traceback (most recent call last):
File "/example/.local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/example/.local/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/example/.local/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/example/.local/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/example/.local/lib/python3.6/site-packages/django/views/generic/base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "/example/app/views.py", line 25, in post
serializer.is_valid(raise_exception=True)
File "/example/.local/lib/python3.6/site-packages/rest_framework/serializers.py", line 242, in is_valid
raise ValidationError(self.errors)
rest_framework.exceptions.ValidationError: {'email': [ErrorDetail(string='Enter a valid email address.', code='invalid')]}
[26/Feb/2020 20:44:54] "POST /login/ HTTP/1.1" 500 84465
In settings.py I have
INSTALLED_APPS = [
# ...
'rest_framework',
]
But I get the same behavior whether I have rest_framework in my INSTALLED_APPS or not.
Adding this to settings.py has no effect either:
REST_FRAMEWORK = {
'EXCEPTION_HANDLER': 'bla',
}
Am I missing something obvious?
It turns out it depends on the view you're sub-classing while throwing the exception.
I was subclassing View, which did not work:
from rest_framework import views
from rest_framework.exceptions import ValidationError
class LoginView(views.View):
def post(self, request):
raise ValidationError()
Switching to using GenericAPIView fixed my issue:
from rest_framework import generics
from rest_framework.exceptions import ValidationError
class LoginView(generics.GenericAPIView):
def post(self, request):
raise ValidationError()
I am trying to display a form with License Type data based on request.user data.
Form works fine when using user as a input variable to the form in the view.
However when I try to upload a file using the same form and use request.File.
I receive following error.
forms.py
from django import forms
class BusinessRequestForm(forms.Form):
business_name = forms.CharField(label='Enter Business Name', widget=forms.Textarea, help_text="Enter the Name of the business you require" )
business_type= forms.ChoiceField(label='Select Your Business Type', choices=BUSINESS_TYPE, help_text="If your business type is not present. Enter details in Additional info" )
license_type =forms.ModelChoiceField(label='Select the license type',queryset=Pricing.objects.none(),help_text="Check Pricing on Main Page Pricing")
additional_detail=forms.CharField(label='Enter any additional details', widget=forms.Textarea, help_text="Give details about your Tax Structure", required=False)
tax_structure=forms.CharField(label='Tax Structure ', widget=forms.Textarea, help_text="Describe Your Tax Structure If Applicable",required=False)
sales_invoice=forms.FileField(help_text="Upload your present Sales Invoice if any",required=False)
purchase_invoice=forms.FileField(help_text="Upload your present Purchase Invoice if any",required=False)
pay_slip=forms.FileField(help_text="Upload your present Pay Slip if any",required=False)
talley_file=forms.FileField(help_text="Upload your present Talley Export if any",required=False)
def __init__(self,input_user,*args,**kwargs):
super(BusinessRequestForm,self).__init__(*args,**kwargs)
select_user=MyProfile.objects.get(user=input_user)
price=Pricing.objects.all().filter(pricing_region=select_user.region).filter(target=select_user.sales_partner)
self.fields['license_type'].queryset=price
models.py
class Business_request(models.Model):
user=models.ForeignKey("auth.User")
business_name=models.CharField("Name of Business Required",max_length=200,help_text="Enter the name of the business")
business_type=models.CharField("Select Business Type",max_length=200,choices=BUSINESS_TYPE,help_text="If your business type is not present,enter in additional details and select the closest type here")
license_type=models.ForeignKey(Pricing)
tax_structure=models.CharField("Tax Structure",max_length=200,help_text="Describe your Tax Structure",blank=True)
additional_details=models.CharField("Enter any additional details",max_length=200,blank=True)
sales_invoice=models.FileField(upload_to='businessReqForm',null=True,blank=True)
purchase_invoice=models.FileField(upload_to='budinessReqForm',null=True,blank=True)
pay_slip=models.FileField(upload_to='budinessReqForm',null=True,blank=True)
talley_file=models.FileField(upload_to='budinessReqForm',null=True,blank=True)
views.py
#login_required
def businessRequestFormView(request):
if request.method == 'POST':
form = BusinessRequestForm(request.FILES,data=request.POST,input_user=request.user,)
if form.is_valid():
business_name=form.cleaned_data['business_name']
business_type=form.cleaned_data['business_type']
license_type=form.cleaned_data['license_type']
additional_details=form.cleaned_data['additional_detail']
tax_structure=form.cleaned_data['tax_structure']
s=Business_request()
s.user=request.user
s.business_name=business_name
s.business_type=business_type
s.license_type=license_type
s.additional_details=additional_details
if request.FILES['sales_invoice']:
sales_invoice=request.FILES['sales_invoice']
s.sales_invoice=sales_invoice
if request.FILES['purchase_invoice']:
purchase_invoice=request.FILES['purchase_invoice']
s.purchase_invoice=purchase_invoice
if request.FILES['pay_slip']:
pay_slip=request.FILES['pay_slip']
s.pay_slip=pay_slip
if request.FILES['talley_file']:
talley_file=request.FILES['talley_file']
s.talley_file=talley_file
s.save()
user=request.user
sender='info#accountingbuddy.org'
subject="AccountingBuddy.Org Business Setup Request Fm %s" % user.first_name
message="Business Name : %s , Business Type: %s , License Type: %s, Additional Details : %s , User %s , Phone %s, Email %s" % (business_name,business_type,license_type, additional_details, request.user,user.myprofile.phone_no,user.email)
recipients = ['keeganpatrao#gmail.com',]
recipients +=[user.email,]
send_mail(subject, message, sender, recipients)
return HttpResponseRedirect(reverse('accountingbuddy:thanks'))
else:
form = BusinessRequestForm(input_user=request.user)
return render(request, 'business_request_form.html', {'form': form})
Error
Environment:
Request Method: POST
Request URL: https://website.com/accountingbuddy/businessrequest/submit/
Django Version: 1.10.7
Python Version: 3.5.2
Installed Applications:
('mezzanine.boot',
'accountingbuddy',
'nova',
'bootstrap3',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.redirects',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.sitemaps',
'mezzanine.conf',
'mezzanine.core',
'mezzanine.generic',
'mezzanine.pages',
'mezzanine.blog',
'mezzanine.forms',
'mezzanine.galleries',
'mezzanine.twitter',
'mezzanine.accounts',
'filebrowser_safe',
'grappelli_safe',
'django.contrib.admin',
'django.contrib.staticfiles',
'django_comments')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'mezzanine.core.request.CurrentRequestMiddleware',
'mezzanine.core.middleware.RedirectFallbackMiddleware',
'mezzanine.core.middleware.TemplateForDeviceMiddleware',
'mezzanine.core.middleware.TemplateForHostMiddleware',
'mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware',
'mezzanine.core.middleware.SitePermissionMiddleware',
'mezzanine.pages.middleware.PageMiddleware')
Traceback:
File "/webapps/accounting/accounting_home/myenv/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
42. response = get_response(request)
File "/webapps/accounting/accounting_home/myenv/lib/python3.5/site-packages/django/core/handlers/base.py" in _legacy_get_response
249. response = self._get_response(request)
File "/webapps/accounting/accounting_home/myenv/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/webapps/accounting/accounting_home/myenv/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/webapps/accounting/accounting_home/myenv/lib/python3.5/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
23. return view_func(request, *args, **kwargs)
File "/webapps/accounting/accounting_home/accounting_home/accountingbuddy/views.py" in businessRequestFormView
49. form = BusinessRequestForm(request.FILES,data=request.POST,input_user=request.user,)
Exception Type: TypeError at /accountingbuddy/businessrequest/submit/
Exception Value: __init__() got multiple values for argument 'input_user'