error class 'django.contrib.auth.models.DoesNotExist -
i'm getting following error message not helpful , there no other error line...
**(<class 'django.contrib.auth.models.doesnotexist'>)**
this code (its ajax call)
@login_required @csrf_exempt def smartpage_create_ajax(request): if request.post: try: json_dict = json.loads(request.post['site']) page = content() page.name = json_dict['name'] page.user(request.user) page.json = request.post['site'] page.save() return httpresponse('ok') except exception e: return httpresponse('%s (%s)' % (e.message, type(e)))
could tell me means working before.
thank you.
update:
class content(models.model): name = models.charfield(max_length=80, blank=true) logo = models.imagefield(upload_to="/logos", blank=true) json = models.textfield() objects = contentmanager() #fk user = models.foreignkey(user, related_name="contentpages", blank=true)
js
$.ajax( { type: "post", url: '../content/createpage', data: "site="+encodeuricomponent(json.stringify(site)), datatype: "json", success: function(ret) { // console.dir(ret); if(ret.result) { $('#build-btns').html(ret.html); } else { //report no builds left $('#build-btns').after(ret.html); } }, error: function(xhr, textstatus, errorthrown) { console.log(xhr, textstatus, errorthrown + 'error'); return false; }, complete: function() { } }); },
the error means get() on user model did not match object in db see :https://docs.djangoproject.com/en/dev/ref/exceptions/#django.core.exceptions.doesnotexist
i suspect logged in user not exist anymore reason. maybe try log in again check if helps.
Comments
Post a Comment