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...
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...
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...
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)...
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?
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...
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...
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: '...
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...
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...