Answer the question
In order to leave comments, you need to log in
Who faced import conflicts?
Without suspecting anything, he created a model with a one-to-many relationship
class Feedback(models.Model):
user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
date = models.DateTimeField(auto_now_add=True)
text = models.TextField(blank=True, max_length=10000)
photos = models.TextField(blank=True, max_length=1000)
-> fas = Feedback(id=None, text='12', photos='1sds')
(Pdb) !Feedback()
<api.controllers.feedback.Feedback object at 0x7feb4d5ba2e8>
(Pdb) !f = Feedback(id=None, text='1', photos='2')
*** TypeError: __init__() got an unexpected keyword argument 'id'
(Pdb) !from api.models import Feedback
(Pdb) !q = Feedback(id=None, text='2', photos='5')
(Pdb) !q
<Feedback: Feedback object>
(Pdb)
# -*- coding: utf-8 -*-
import logging
import re
from django.core.mail import send_mail
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from api.models import UserProfile
from api.models import Feedback
from api.utils.request_data import req_data
from backend.settings import EMAIL_HOST_USER, upload_dir
(Pdb) !Feedback()
<api.controllers.feedback.Feedback object at 0x7f76497d72e8>
(Pdb) !from api.models import Feedback
(Pdb) !Feedback()
<Feedback: Feedback object>
(Pdb)
Internal Server Error: /api/v1/feedback
Traceback (most recent call last):
File "/home/maxim/buzz/lib/python3.5/site-packages/django/core/handlers/base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "/home/maxim/buzz/lib/python3.5/site-packages/django/core/handlers/base.py", line 147, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/maxim/buzz/lib/python3.5/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/home/maxim/PycharmProjects/back_new/app/back/api/controllers/feedback.py", line 36, in get
f = Feedback(id=None, user=user, text=text, photos=photo)
TypeError: __init__() got an unexpected keyword argument 'user'
[14/Jul/2017 11:46:14] "POST /api/v1/feedback HTTP/1.1" 500 74215
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question