I would like create authentication in Django. I'm trying to do everything according to this. Unfortunately, at this moment I have two problems. Firstly, when I try to add from rest_framework.authtoken import views I have conflict with from companies
I created a end-point that returns a PDF. I have an condition to check if the asset exists, but that condition is always ignored. If the condition doesn't exist the end-point returns 500 not 404 as I want urls: url(r'^report/asset/(?P<pk>[0-9]+)$',
I'm using Django REST framework JWT Auth for session creation and permissions, the only problem is: when I log in and after the token expires I can't continue doing the operation I want, unless I log in again. And I didn't fully understand the docume
I have a requirement to build a social networking back-end using Django Rest framework, Where each user can see the Feeds from their Friends, which is stored in the Feeds-Table. I am currently using a view to generate the output. here is my models.py
I have three different models that I want to gather in a feed type page. They do all contain different types of things but for simplicity, the models are the same in this instance. class ObjectA(models.Model): text = models.TextField() pub_date = mod
I have: class ProfileSerializer(serializers.ModelSerializer): relevence = ?? The thing is I want to call relevance as a separate function. I do not want to write it as a serializer method field nor under a model, can it be done?Ok. do it like class P
I have an Instructor model, which has a many to many field to a Client model. (Instructor.clients) The model: class InstructorProfile(models.Model): '''Instructor specific profile attributes ''' # Fields office_number = models.CharField(max_length=30
I'm trying to upload a picture with rest framework and to test it with the django test client. It almost works, however when I save the file I have this on the top of my file: --BoUnDaRyStRiNg Content-Disposition: form-data; name="plop.png" If I
I'm new to Django rest and i'm trying to return response that have to use two query sets: The first one is for the specific project and the second one is only for specific users inside this project: serializers.py class ProjectFiltersSerializer(seria
I'm trying to create users with the rest framework, but i can create more than one with the same email, how do i validate email taken? this is my serializer code: from django.contrib.auth.models import User from django.contrib.auth import get_user_mo
I'm using a custom authentication scheme and I cannot figure out how to get it to send 401 HTTP responses instead of 403. The guide at http://www.django-rest-framework.org/api-guide/authentication/#custom-authentication says to override the authentic
I need to know how to restrict access to Authenticated Users such that User Records can be listed in full for those logged in as Administrator and for those logged in as a User only their records can be listed, updated and created for themslefves. Cu
I have an API developed with Django and Django Rest Framework. I've got a model with a DecimalField which should store values of at least one. Therefore, I've defined the field in the following way: goal = models.DecimalField(decimal_places=2, max_di
I have these serializers: >---id = serializers.IntegerField() >---name = serializers.CharField() >---age = serializers.IntegerField() Now, I give the serializers this data: {'id': 1, 'name': 'cc'} I don't give a value for age. how can I set a def
I have this custom user model: class CustomUser(AbstractBaseUser,PermissionsMixin): email = models.CharField(max_length=255, unique=True) .... And this view that is supossed to require authentication in order to run: @authentication_classes((TokenAut
This is my Model: class Post(models.Model): user = models.ForeignKey(User) post = models.CharField(max_length=400) country = models.ForeignKey(Country, blank=True, null=True) and this is my serializer: class PostSerializer(serializers.ModelSerializer
I'm working in a django project and I'm building an Api using Django Rest Framework for let users get some data on their mobile devices. I'm sending some extra paramenters in the headers dictionary for each request, not only the auth token. I'm testi
I'm trying to achieve something with Django Rest Framework. The idea is for a model to have several fields of several types in read-only, and have the same fields writable for the user that would take precedence when serving the data. Since this shou
6.30.15 - HOW CAN I MAKE THIS QUESTION BETTER AND MORE HELPFUL TO OTHERS? FEEDBACK WOULD BE HELPFUL. THANKS! I need to send a content-range header to a dojo/dgrid request: I cannot find any examples of HOW to do this. I'm not exactly sure where this
I'm using django-rest-swagger to document and test an API and it has been working very well up to now but the following error has occured: AttributeError at /docs/api-docs/app 'PeriodSerializer' object has no attribute 'get_fields' 'PeriodSerializer'
In my tests, I send mock data of models that I've passed through the serializer. The serializer.data looks something like this { "field": None } However, the data that my API receives is formatted like { "field": "None" } whi
I have two models and need to serialize Article as Geojson by setting the geo_field attribute as point from the Location model. After following the solution given here I get the error: Got AttributeError when attempting to get a value for field `poin
My form will post data to db. I want to add one filed as hidden in view and it should generate a key as random. my post function is def post(self, request, format=None): request.data['code'] = id_generator() data = request.data serializer = registrat
I have Category and Article model,Article has a foreign key reference Category,in my serializer i can get the name column in Category model because of the __str__ method,but how can i get other columns in Category model models.py: # blog category mod
I have a few fields in my user model that are choice fields and am trying to figure out how to best implement that into Django Rest Framework. Below is some simplified code to show what I'm doing. # models.py class User(AbstractUser): GENDER_CHOICES
I have a serializer that validates fields based on the values of other fields, In the error response I would like to show each field error as a field error as opposed to showing everything under "non_field_errors" which is what would happen if I
Trying to access my json page I get this error! AttributeError at /project/api/1.json Got AttributeError when attempting to get a value for field `title` on serializer `TaskSerializer`. The serializer field might be named incorrectly and not match an
If I have a error outside the libs of DRF, django send back the HTML of the error instead of the proper error response use by DRF. For example: @api_view(['POST']) @permission_classes((IsAuthenticated,)) def downloadData(request): print request.POST[
Using django-rest-framework. I'm getting HTTP 403 errors when running in production behind nginx. When I call a particular view, which inherits from APIView to support a GET operation, I get: {"detail": "Invalid username/password"} But
Not sure if i'm using the right vocabulary. In the browsable api that comes for free with django-rest-framework, I was wondering if there was a way to autogenerate a form similar to how we define ModelForms. This would allow us to more easily test in