Questions tagged as 'django'

1
answer

App name error in django

In my views, from django 1.10, I have the code: from django.shortcuts import * from appcrud.forms import * def inicial(request): if request.method == "POST": form = FormCrud(request.POST) if form.is_valid(): form.save() e...
asked by 04.02.2017 / 04:48
1
answer

Problem creating the environment with django

I'm trying to create a project in virtualized environment with the virtualwrapper tool, in this environment I installed django but when trying to create a project with the command django-admin startproject meu-projeto it does not create t...
asked by 07.12.2016 / 19:14
1
answer

DjandoRestFramework standardize endpoints for methods with different permissions

I'm using Django 1.10 with the DRF lib. I created an endpoint / api / contact / and in this endpoint I apply 2 methods (GET and POST), GET can only be viewed with permission, and POST can be requested without permission. The problem is in the...
asked by 20.01.2017 / 15:23
1
answer

Redirect and Render in Django

I have a views.py file that has the following method: def alterar(request, pk): cliente = get_object_or_404(Cliente, pk=pk) if request.method == 'POST': form = ClienteForm(request.POST, instance = cliente)...
asked by 02.11.2016 / 16:19
1
answer

What if I do not want any queryset in a Django view?

There are urls that I just need to set a session or consult a restful API ... anyway. What if I do not want a queryset? Why does django seem to force me to define one? Would you have some kind of different view for this?     
asked by 16.12.2016 / 17:40
2
answers

How to go to a url in django regardless of the way we are?

I created a menu in a base file that is visible regardless of the page we are on, <p> Tela de perfil <a href="perfil/">Perfil</a></p> The problem is that when we are on the same page and click on the same lin...
asked by 17.08.2016 / 01:28
1
answer

Security Token Authentication Django Rest Framework

Good people I'm using DRF (I'm newbie rs), to put together a small API. The problem comes in authentication ... thinking of expanding my API to use in a mobile app in the future, I've been wanting to use token authentication. It's all working fi...
asked by 23.09.2016 / 16:01
1
answer

Passing an array via Ajax to Django view

I want to pass an array via Ajax to my Django view, but an error always occurs    stream_or_string = stream_or_string.read ()       AttributeError: 'NoneType' object has no attribute 'read' $.ajax({ url: 'ajax/', type: '...
asked by 12.08.2016 / 16:28
1
answer

Error Django csv

Well, I'm having a problem reading csv and entering the data. I believe it's in the foreign key. The code is: View: def csvAih(request): coluna = 1 mes = 1 ano = 2008 while (ano < 2017): with o...
asked by 13.09.2016 / 00:48
1
answer

Using search and pagination field with Function Based View in Django

I have the following code: #decorators.py from django.contrib.auth.decorators import user_passes_test def superuser_required(func): return user_passes_test( lambda u: u.is_authenticated() and u.is_superuser)(func) # views.py @su...
asked by 30.06.2016 / 05:36