Psycopg2.ProgrammingError: can't adapt type 'res.branch' in odoo - odoo

Does anyone know this error? I've tried looking it up on the internet, but I can't figure it out
The error appears when pressing the button to create multiple rfq,
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/me/usr/project_odoo14/odoo/http.py", line 639, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/me/usr/project_odoo14/odoo/http.py", line 315, in _handle_exception
raise exception.with_traceback(None) from new_cause
psycopg2.ProgrammingError: can't adapt type 'res.branch'
This is the code from the button :
def create_rfq(self):
context = dict(self.env.context) or {}
new_order_id = []
for rec in self:
for vendor_id in rec.vendor_ids:
vals = {
'partner_id' : vendor_id.id,
'picking_type_id': rec._get_default_picking_type()
}
if context.get('is_goods_order'):
context.update({'goods_order': True})
vals.update({'is_goods_orders': True})
elif context.get('services_good'):
context.update({'services_good': True})
vals.update({'is_services_orders': True})
elif context.get('assets_orders'):
context.update({'assets_orders': True})
vals.update({'is_assets_orders': True})
data = []
for record in rec.product_ids:
data.append((0,0, {
'product_id' : record.id,
'date_planned': datetime.now(),
}))
vals.update({
'order_line': data,
'date_order': datetime.now()
})
order_id = self.env['purchase.order'].with_context(context).create(vals)
order_id.set_analytic_group()
new_order_id.append(order_id.id)
for line in order_id.order_line:
line.destination_warehouse_id = rec.env['stock.warehouse'].search([], order="id", limit=1)
line._onchange_quantity()
return {
'type': 'ir.actions.act_window',
'name': _('Requests for Quotation'),
'res_model': 'purchase.order',
'view_mode': 'list,form',
'domain': [('id', 'in', new_order_id)],
}
Please help me to solve this problem,
Thank you

Related

Why I've got a error "Ref expected, Object provided"?

With Python API, I've created a document in the collection "spells" as follows
>>> client.query(
... q.create(
... q.collection("spells"),
... {
... "data": {"name": "Mountainous Thunder", "element": "air", "cost": 15}
... }
... ))
{'ref': Ref(id=243802653698556416, collection=Ref(id=spells, collection=Ref(id=collections))), 'ts': 1568767179200000, 'data': {'name': 'Mountainous Thunder', 'element': 'air', 'cost': 15}}
Then, I've tried to get the document with its ts as follows:
>>> client.query(q.get(q.ref(q.collection("spells", "1568767179200000"))))
But, the result is, the error as "Ref expected, Object provided".
>>> client.query(q.get(q.ref(q.collection("spells", "1568767179200000"))))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/faunadb/client.py", line 175, in query
return self._execute("POST", "", _wrap(expression), with_txn_time=True)
File "/usr/local/lib/python3.6/dist-packages/faunadb/client.py", line 242, in _execute
FaunaError.raise_for_status_code(request_result)
File "/usr/local/lib/python3.6/dist-packages/faunadb/errors.py", line 28, in raise_for_status_code
raise BadRequest(request_result)
faunadb.errors.BadRequest: Ref expected, Object provided.
I've no idea what was wrong, any suggestions are welcome!
I've solved this myself. I've also missed parameters with q.ref.
The correct params are as follows:
>>> client.query(q.get(q.ref(q.collection("spells"),"243802585534824962")))
{'ref': Ref(id=243802585534824962, collection=Ref(id=spells, collection=Ref(id=collections))), 'ts': 1568767114140000, 'data': {'name': 'Mountainous Thunder', 'element': 'air', 'cost': 15}}

How to solve the error when clicking the button for open new form in odoo10?

def create_file(self):
opportunity_id = self.convert_to_file()
return self.env['trademark.process'].view_file(opportunity_id)
I used convert file function to pass some values of current model to trademark.process
def convert_to_file(self, partner_id=False):
tm_process_obj = self.env['trademark.process']
tm_search_record = self.env['trademark.search'].browse(self.id)
for rec in tm_search_record:
opportunity_id = tm_process_obj.create({
'search_name_char': rec.search_name or False,
'classification_no_id':rec.classification_no_id.id or False,
'partner_id': rec.partner_id.id or False,
'user_id': rec.user_id.id or False,
'search_date': rec.search_date or False,
'search_seq_no': rec.seq_no or False,
})
vals = {
'file_no': opportunity_id.seq_no,
}
self.write(vals)
return opportunity_id
Then finally i return opportunity id and passed to view file function.
def view_file(self, opportunity_id):
view_id=self.env.ref('trademark_services.trademark_process_form_view').id
return {
'name': _('File Details'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'trademark.process',
'view_id': view_id,
'res_id': opportunity_id,
'target':'current'
}
But an error occured when i click the button .
Traceback (most recent call last):
File "/home/ubuntu/workspace/amzsys_erp/odoo/http.py", line 638, in
_handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/ubuntu/workspace/amzsys_erp/odoo/http.py", line 689, in
dispatch
return self._json_response(result)
File "/home/ubuntu/workspace/amzsys_erp/odoo/http.py", line 627, in
_json_response
body = json.dumps(response)
File "/usr/lib/python2.7/json/__init__.py", line 243, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: trademark.process(131,) is not JSON serializable
How to solve this issue.How to open new form when i clicking the button.
I want to pass some values to that form.
What is the mistake in my code?
Note:using odoo10
Problem in this method where you are passing res_id.
Use opportunity_id.id.
def view_file(self, opportunity_id):
view_id=self.env.ref('trademark_services.trademark_process_form_view').id
return {
'name': _('File Details'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'trademark.process',
'view_id': view_id,
'res_id': opportunity_id.id,
'target':'current'
}

Odoo: ValueError("Expected singleton: %s" % self)

I'm modifying Odoo OpenEduCat exam module to fit the need of my institution. For that, I have tailored the code as shown below. However,when I click on generate button, odoo raises expected singleton error. Generating button
Error details
--Python code--
from openerp import models, fields, api
class OpResultTemplate(models.Model):
_name = 'op.result.template'
_description = 'Result Template'
_rec_name = 'name'
exam_session_id = fields.Many2one(
'op.exam.session', 'Exam Session', related='line_ids.exam_session_id', required=False)
name = fields.Char("Name", size=254, required=True)
result_date = fields.Date(
'Result Date', required=True, default=fields.Date.today())
line_ids = fields.One2many(
'op.result.template.line', 'result_id', 'Session Lines')
####this is for semester
inter1_ids = fields.One2many(
'op.internal1', 'result_id', 'Internal 01')
inter2_ids = fields.One2many(
'op.internal2', 'result_id', 'Internal 02')
model_ids = fields.One2many(
'op.model', 'result_id', 'Model')
final_ids = fields.One2many(
'op.final', 'result_id', 'Semester')
state = fields.Selection(
[('normal', 'Normal'), ('semester', 'Semester')],
string='State', required=True, default='normal')
# pass_status_ids = fields.Many2many('op.pass.status', string='Pass Status')
#api.one
def generate_result(self):
data = self.read(['state'])[0]
if data['state'] == 'normal' :
####Write information in to Marksheet Register the place where result generate to.
marksheet_reg_id = self.env['op.marksheet.register'].create({
'name': 'Mark Sheet for %s' % self.line_ids.exam_session_id.name,
'exam_session_id': self.line_ids.exam_session_id.id,
'generated_date': fields.Date.today(),
'generated_by': self.env.uid,
'status': 'draft',
'course_id': self.line_ids.exam_session_id.course_id.name,
'batch_id': self.line_ids.exam_session_id.batch_id.name,
'exam_type': self.line_ids.exam_session_id.exam_type.name,
'semester_id': self.line_ids.exam_session_id.semester_id.name,
})
student_list = []####Define array to store
for exam_session in self.line_ids:####line_ids is table that located in Result generator which allow to choose exam session
total_exam = 0.0#global var
for exam in exam_session.exam_session_id:####exam_session.exam_lines is the table that list the exam or subject located in Result generator->Exam session
total_exam += exam.exam_ids.total_marks
for attd in exam.exam_ids.attendees_line:####exam.exam_id.attendees_line location that contant student name and mark in each subject
result_dict = {####this loop is to write information to result line
'exam_id': exam.exam_ids.id,
'exam_tmpl_id': exam.exam_ids.id,
'marks': attd.marks,####IMPORTANCE mark that student get in each subject THIS IS WHERE TO APPLY PERCENTAGES
'status': attd.marks >= exam.exam_ids.min_marks and####IMPORTANCE take the mark and decide pass or fail base on passing mark in each subject
'pass' or 'fail',
'per': (100 * attd.marks) / exam.exam_ids.total_marks,####NOT IMPORTANCE this can be delete, this take the mark student get and find the percentage of the subject student get in each subject
'student_id': attd.student_id.id,####student name
'total_marks': exam.exam_ids.total_marks,####the total mark of each subject that have been enter when created subject for exam
}
--Error details--
Odoo Server Error
Traceback (most recent call last):
File "/home/v4d/odoo/openerp/http.py", line 650, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/v4d/odoo/openerp/http.py", line 687, in dispatch
result = self._call_function(**self.params)
File "/home/v4d/odoo/openerp/http.py", line 323, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/v4d/odoo/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/home/v4d/odoo/openerp/http.py", line 316, in checked_call
result = self.endpoint(*a, **kw)
File "/home/v4d/odoo/openerp/http.py", line 966, in call
return self.method(*args, **kw)
File "/home/v4d/odoo/openerp/http.py", line 516, in response_wrap
response = f(*args, **kw)
File "/home/v4d/odoo/addons/web/controllers/main.py", line 899, in call_button
action = self._call_kw(model, method, args, {})
File "/home/v4d/odoo/addons/web/controllers/main.py", line 887, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/home/v4d/odoo/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/v4d/odoo/openerp/api.py", line 421, in old_api
result = new_api(recs, *args, **kwargs)
File "/home/v4d/odoo/openerp/api.py", line 425, in new_api
result = [method(rec, *args, **kwargs) for rec in self]
File "/home/v4d/odoo/addons/openeducat_exam/models/result_template.py", line 71, in generate_result
total_exam += exam.exam_ids.total_marks
File "/home/v4d/odoo/openerp/fields.py", line 821, in get
record.ensure_one()
File "/home/v4d/odoo/openerp/models.py", line 5432, in ensure_one
raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: op.exam(44, 45, 46)
I have tried other solutions that could be found on the Internet, but it didn't seem to work. Please kindly help me to deal with this.Thank in advance.
Here is the issue in your code,
####IMPORTANCE take the mark and decide pass or fail base on passing mark in each subject
'status': attd.marks >= exam.exam_ids.min_marks and 'pass' or 'fail',
exam.exam_ids it will return list of browsable objects (recordset list) and you are trying to access min_marks properties, so here it gets confused min_marks property from which object. So it raise an error.
So either you need to specify single object by specifying exam.exam_ids[0] (only single object will return) or you need to search proper records from the one2many model and then you can access to the min_marks field.
Properties are separately created for all objects (OOP rule). Static
properties will be accessible via class.

AttributeError: 'bool' object has no attribute 'strftime'

I am inheriting 'account.partner.ledger' module. When we select the customer we will be able to print the report of the customer's ledger. In the partner ledger menu I want to make 'include Initial Balances' checkbox checked by default if the filter is by date/period.I tried to override the method by my custom module but I am unable to solve the error which I am getting.
Code,
#api.multi
def onchange_filter(self,filter='filter_no', fiscalyear_id=False):
res = super(account_partner_ledger, self).onchange_filter(filter=filter, fiscalyear_id=fiscalyear_id)
if filter in ['filter_no', 'unreconciled']:
if filter == 'unreconciled':
res['value'].update({'fiscalyear_id': False})
res['value'].update({'initial_balance': False, 'period_from': False, 'period_to': False, 'date_from': False ,'date_to': False})
if filter in ['filter_date','filter_period']:
res['value'].update({'initial_balance': True, 'period_from': True, 'period_to': True, 'date_from': True ,'date_to': True})
return res
Error,
Traceback (most recent call last):
File "C:\Users\zendynamix\odooGit\odoo8\openerp\http.py", line 544, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\http.py", line 581, in dispatch
result = self._call_function(**self.params)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\http.py", line 317, in _call_function
return checked_call(self.db, *args, **kwargs)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\service\model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\http.py", line 314, in checked_call
return self.endpoint(*a, **kw)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\http.py", line 810, in __call__
return self.method(*args, **kw)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\http.py", line 410, in response_wrap
response = f(*args, **kw)
File "C:\Users\zendynamix\odooGit\odoo8\addons\web\controllers\main.py", line 944, in call_kw
return self._call_kw(model, method, args, kwargs)
File "C:\Users\zendynamix\odooGit\odoo8\addons\web\controllers\main.py", line 936, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\api.py", line 399, in old_api
result = method(recs, *args, **kwargs)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\models.py", line 5985, in onchange
record._onchange_eval(name, field_onchange[name], result)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\models.py", line 5883, in _onchange_eval
self.update(self._convert_to_cache(method_res['value'], validate=False))
File "C:\Users\zendynamix\odooGit\odoo8\openerp\models.py", line 5391, in _convert_to_cache
for name, value in values.iteritems()
File "C:\Users\zendynamix\odooGit\odoo8\openerp\models.py", line 5392, in <dictcomp>
if name in fields
File "C:\Users\zendynamix\odooGit\odoo8\openerp\fields.py", line 1250, in convert_to_cache
return self.to_string(value)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\fields.py", line 1240, in to_string
return value.strftime(DATE_FORMAT) if value else False
AttributeError: 'bool' object has no attribute 'strftime'
You have to look at the underlying code sometimes to understand what's going on, you're getting errors because Odoo is trying to convert a boolean object back to a string representation of a time (it expects a python date object)
You can fire up a terminal and reproduce your error:
>>> True.strftime
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'bool' object has no attribute 'strftime'
>>>
This is the to_string method from odoo
#staticmethod
def to_string(value):
""" Convert a :class:`date` value into the format expected by the ORM. """
return value.strftime(DATE_FORMAT) if value else False
The test condition if value test's to see if value evaluates to False, testing from the terminal
>>> x = ''
>>> if x: print('Yeah')
...
>>>
>>> x = True
>>> if x: print('Yeah')
...
Yeah
>>> x = False
>>> if x: print('Yeah')
...
>>>
>>>
from the output, we can draw a conclusion that an empty string or False evaluates to False while a True value will evaluate to True, so instead of setting the date values to True, set all of them to empty strings.
#api.multi
def onchange_filter(self,filter='filter_no', fiscalyear_id=False):
res = super(account_partner_ledger, self).onchange_filter(filter=filter, fiscalyear_id=fiscalyear_id)
if filter in ['filter_no', 'unreconciled']:
if filter == 'unreconciled':
res['value'].update({'fiscalyear_id': False})
res['value'].update({'initial_balance': False, 'period_from': False, 'period_to': False, 'date_from': False ,'date_to': False})
if filter in ['filter_date','filter_period']:
res['value'].update({'initial_balance': 'True', 'period_from': '', 'period_to': '', 'date_from': '', 'date_to': ''})
return res
When you look at your code you'll see:
'date_from': True ,'date_to': True
This causes your error.
You should set those fields to a date not to a Boolean.
The value False is valid, since you should be able to not fill in a date.
Try using strptime instead of strftime and see if it solves the problem.
You can use strptime as follows for example:-
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
my_date = datetime.strptime(self.date_column, DEFAULT_SERVER_DATETIME_FORMAT)

<StdImageFieldFile: None> is not JSON serializable

I'm using django-stdimage for uploading and resizing images, and it works well.
I'm having a problem, though, with django-allauth; when I try to login with the social account, and there already is a normal account with the same e-mail address, I'm getting the following error:
TypeError at /accounts/facebook/login/callback/
is not JSON serializable
This is the full traceback:
Environment:
Request Method: GET
Request URL: http://localhost:8000/accounts/facebook/login/callback/?code=AQCf7MjgfOAsqf0sS0gup0hqLKyZClQvkGKyWtkORNBru_ITaRNHKgxwaH5RaCSARIb9U1ZgnqhWm3OQAfKW1r5nbVRkKr4fcLWtXdGL85-LYIyuF-NftkJpIhdIMR-VTMF8XXbKescZhxz0hDP_eKl1tKL6uPqWKc8NliWWHh9kOYSS69rAzNRUjZhgx6Zul9sAkV9nRoDo-JunhDRtvOV3crnpr9zAU6jsPDChcJ5dgcRPQ39EoOhrDE16-ia6WF1lFMz_fw1Pgjvo-2jduNG-c9TPyY23A205wm3d1PItoXH2U4GU8j1u5iAg1OIJuvDh-2viQA1disQoM_Du3vUldbX4Plun-yNay2kzNepOyw&state=0J6Ydn3lDKi0
Django Version: 1.8
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'blog',
'custom_user',
'django_markdown',
'storages',
'parsley',
'stdimage',
'stdimage_serializer',
'rest_framework',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook')
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 "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
132. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/allauth/socialaccount/providers/oauth2/views.py" in view
62. return self.dispatch(request, *args, **kwargs)
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/allauth/socialaccount/providers/oauth2/views.py" in dispatch
135. return complete_social_login(request, login)
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/allauth/socialaccount/helpers.py" in complete_social_login
145. return _complete_social_login(request, sociallogin)
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/allauth/socialaccount/helpers.py" in _complete_social_login
161. ret = _process_signup(request, sociallogin)
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/allauth/socialaccount/helpers.py" in _process_signup
26. request.session['socialaccount_sociallogin'] = sociallogin.serialize()
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/allauth/socialaccount/models.py" in serialize
198. user=serialize_instance(self.user),
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/allauth/utils.py" in serialize_instance
194. return json.loads(json.dumps(data, cls=DjangoJSONEncoder))
File "/usr/lib/python2.7/json/__init__.py" in dumps
250. sort_keys=sort_keys, **kw).encode(obj)
File "/usr/lib/python2.7/json/encoder.py" in encode
207. chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/json/encoder.py" in iterencode
270. return _iterencode(o, 0)
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/django/core/serializers/json.py" in default
112. return super(DjangoJSONEncoder, self).default(o)
File "/usr/lib/python2.7/json/encoder.py" in default
184. raise TypeError(repr(o) + " is not JSON serializable")
Exception Type: TypeError at /accounts/facebook/login/callback/
Exception Value: <StdImageFieldFile: None> is not JSON serializable
I can't understand if it's a django-allauth problem or something else.
This is models.py:
class CustomUser(AbstractBaseUser, PermissionsMixin):
first_name = models.CharField(max_length=254, blank=True)
second_name = models.CharField(max_length=254, blank=True)
email = models.EmailField(blank=True, unique=True)
date_joined = models.DateTimeField(_('date joined'), default=datetime.now())
#avatar = models.ImageField('profile picture', upload_to=upload_avatar_to, null=True, blank=True)
avatar = StdImageField(upload_to=upload_avatar_to, null=True, blank=True,
variations={
'thumbnail': {'width': 250, 'height': 250, "crop": True}
})
is_active = models.BooleanField(default=False)
is_admin = models.BooleanField(default=False)
is_staff = models.BooleanField(default=False)
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['first_name', 'second_name']
objects = CustomUserManager()
class Meta:
verbose_name = _('user')
verbose_name_plural = _('users')
def save(self, *args, **kwargs):
super(CustomUser, self).save(*args, **kwargs)
def get_absolute_url(self):
return "/users/%s" % urlquote(self.email)
def get_full_name(self):
"""
Returns the first_name plus the last_name, with a space in between.
"""
return self.email
def __str__(self):
return self.email
def get_short_name(self):
"""
Returns the first name for the user.
"""
return self.first_name
def email_user(self, subject, message, from_email=None):
"""
Sends an email to this user.
"""
send_email(subject, message, from_email, [self.email])
I've also tried to use django-stdimage-serializer, but when I try to set up the models file with it, and fire up makemigrations, that's what I get:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute
django.setup()
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/stefano/projects/blog-project/blog/models.py", line 6, in <module>
from custom_user.models import CustomUserManager, CustomUser
File "/home/stefano/projects/blog-project/custom_user/models.py", line 52, in <module>
class CustomUser(AbstractBaseUser, PermissionsMixin):
File "/home/stefano/projects/blog-project/custom_user/models.py", line 60, in CustomUser
'thumbnail': {'width': 250, 'height': 250, "crop": True}
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/rest_framework/fields.py", line 1405, in __init__
super(ImageField, self).__init__(*args, **kwargs)
File "/home/stefano/projects/blog-project/blogprojectenv/local/lib/python2.7/site-packages/rest_framework/fields.py", line 1359, in __init__
super(FileField, self).__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'upload_to'
What could I do?
If anyone is interested, this answer is exactly what I was looking for.