Django - CurrentUserField - django

I was just exploring http://code.djangoproject.com/ticket/1132 I am receiving 'undefined' error while using 'models.CurrentUserField' . Is this supported by Django 1.2.3?

Related

Django test logs Bad or Unauthorized requests

I recently upgraded from django 1.11 to django 3.0.
Currently, when i launch python manage.py test, django logs any bad or unauthorized requests from my tests, the fact is : it did not log such while on 1.11
Exemple :
.2021-01-06 18:04:20,374 Unauthorized: /api/image/create
..2021-01-06 18:04:20,426 Bad Request: /api/image/transfer/create
.2021-01-06 18:04:20,436 Bad Request: /api/image/transfer/create
...
----------------------------------------------------------------------
Ran 3 tests in 0.008s
OK
Preserving test database for alias 'default'...
Did i miss something while reading django changelog ?
I'd like some light because i do not want to make a distribution without knowing if it's only warning or real error.
Since django 2.1, they added logging to error 4xx and 5xx :
https://github.com/django/django/commit/10b44e45256ddda4258ae032b8d4725a3e3284e6
Just do before launching test :
import logging
logger = logging.getLogger('django.request')
logger.setLevel(logging.ERROR)
or create a decorator for each test you want to silence.

Django Rest Framework deploy show favicon 500 Internal Server Error

I am trying to deploy my Django rest framework to aws eb but when I test the API, it shows
favicon.ico:1 GET
http://myapp.....com/favicon.ico
500 (Internal Server Error)
I update my url.py of django project to
from django.views.generic.base import RedirectView
urlpatterns = [
url('favicon.ico', RedirectView.as_view(
url='/static/favicon/favicon.ico'))...]
But It still shows an internal error.
I already search and found similar questions but not a useful answer.
like that=>
How do I edit the favicon in the browsable API in Django rest framework
how to handle favicon request in Django rest framework
My API is pretty separate from the frontend so I can't change frontend for this error.
Update
If I test on local like =>
http://127.0.0.1:8000/favicon.ico
it gets the same result with =>
http://127.0.0.1:8000/api/

Ember / Ember Data - Error: The adapter operation was aborted after 201 created

Ember 3.0.0
Ember Data 3.0.2
Ruby on Rails 5.2.0
When using Ember and Ember Data to create a new record on a backend server using the default adapter (JSON_API) I get the following weird scenario:
The data is posted correctly to the backend and the backend replies with a 201 Created reply along with the new record rendered as JSON_API. I have used cUrl to simulate a POST to the backend and the reply is correct. However the adapter still rejects the operation.
When storing the record I use:
newAccount.save().then(allIsOk).catch(failure);
Even though the record is saved correctly and the backend server replies with a 201 Created the allIsOk is never called - only the .catch(failure) is triggered.
I have tried to change the reply from the backend server to 204 No content but the problem persists.
The CORS config for the backend server is as follows:
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '*',
headers: :any,
methods: %i[get post put patch delete options head]
end
end
We have developed a lot of apps in the past using the 2.x branch of Ember without any problems. I am really not sure where the error could be. The backend seems to be working correctly returning the correct data so I assume that the problem is with Ember / Ember Data or just me missing a tiny detail somewhere.
The only related topics I can find are these:
POST request to API from Ember often fails with 'The adapter operation was aborted Error'
https://github.com/cyu/rack-cors/issues/106
Found the solution to the problem. Please see here for info:
https://github.com/emberjs/data/issues/5440

Upload image to Swift from Django Rest Framework

I have a problem related with uploading images directly to object storage Swift, using Django Rest Framework.
Most of tutorials present simple upload images to /media/ directory in localhost, but this option is not going to fit in my project.
Tried use django-storage-swift - https://github.com/blacktorn/django-storage-swift . While doing requests using httpie, I received in 50% of requests an error:
requests.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:600)
[06/Jun/2017 13:03:01] "POST /api/processing_raw_files/ HTTP/1.1" 500 24946
This makes, that only half of uploading files will be in fact sending to the cloud.
I am working on
Ubuntu 14.04
Python 3.4.3
Django 1.11
djangorestframework 3.6.2
django-storage-swift 1.2.16
Do you know any other possibility how can I upload images using swift and django rest? Or did you face with ssl error utilizing django-storage-swift?

findQuery - Emberfire error

I am getting this errror:
This is the line I am using to get data --> return this.store.find('food', {feel: 2});
I am using,
Ember : 1.10.0
Ember Data : 1.0.0-beta.12
EmberFire : 1.3.3
jQuery : 1.11.2
Error while processing route: index Assertion Failed: You tried to load a query but your adapter does not implement findQuery Error: Assertion Failed: You tried to load a query but your adapter does not implement findQuery
I'm am not sure if this is Ember.js specific or if the root of the problem is coming from Firebase? Any tips?
EmberFire 1.3.3 did not support findQuery but the latest release (1.4.1) does. Details are here: https://www.firebase.com/blog/2015-03-09-new-emberfire-features.html