# settings.py
CSRF_TRUSTED_ORIGINS = ['api.yoursite.ru']
from django.core.exceptions import NON_FIELD_ERRORS
from django.forms import ModelForm
class ArticleForm(ModelForm):
class Meta:
error_messages = {
NON_FIELD_ERRORS: {
'unique_together': "%(model_name)s's %(field_labels)s are not unique.",
}
}
@api_view(['GET'])
@renderer_classes([JSONRenderer])
def get_data(request, format=None):
"""
A view that returns JSON.
"""
data = {
"import_id": 7
}
content = {'data': data}
return Response(content)