Rajjix
filter(username=’something’)
filter(username__iexact=‘something’)
...read the docs
Rohan
model.objects.filter(x=<some value>).values(...)
Rohan
in case you have variable filter, you can use **kwargs and pass a dictionary
Anonymous
Anonymous
Thanks
Rohan
Entry.objects.get(headline__contains='Lennon')
Rohan
Entry.objects.get(headline__iexact='Lennon')
Rohan
Rajjix
Rohan
Rohan
BTW __contains is case sensitive
Rohan
for case insensitive, __icontains
Rajjix
.get(<some_filter>) == .filter().get() 🤔
Rohan
Rajjix
that’s my point
Rohan
Rohan
Ah, right. I was just giving example of syntax. he can use it in filter as well.
R
Hi there,
I am trying to config single sign in with iss with django. The negotiation happens, but I don't get the user back in response. Do you know how to do it?
Anonymous
https://dpaste.de/b2zR
Anonymous
What should it return
George
inchidi
George
Yeah
Isaías
django rest framework does not obey: {
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'
'OPTIONS': {
'min_length': 6,
}
}?
Rajjix
as an option check the source code in your environment files, to check what parameters are accepted
Isaías
The problem is this: register a new user in django admin with a password of 6 characters. More via api (django rest) validation requires a password of 8 characters.
Isaías
Bizarre! Must obey my settings
Rajjix
are you no typos, or curly brackets fuckups ?
Rajjix
This should allow you to do 6 letter password in your admin panel and shell command
Isaías
resolved!
Rajjix
what was it
Modou-dev
hi can someone help me about (TemplateDoesNotExist at /api/ ) I still get this error when I try to launch my app
Modou-dev
Rajjix
urls.py
Modou-dev
from django.urls import path
from .views import PostPageView
urlpatterns = [
path('',PostPageView.as_view(), name='posts'),
]
Modou-dev
and the view
Modou-dev
and the view
from django.shortcuts import render
from django.views.generic import ListView
from .models import Post
# Create your views here.
class PostPageView(ListView):
model = Post
template_name='template/posts.html'
Rajjix
template or templates?
Rohan
"Templates"
Modou-dev
error I wanted to write Templates But
Modou-dev
It doesn't work
Rajjix
I don’t understand
Rajjix
Django by default looks for a templates folder not template
Inside your app
Rajjix
Unless you defined a new template directory in settings
Rajjix
and called it template without the s
Modou-dev
okay I see
Modou-dev
let me try again
Modou-dev
thanks I will try to find the solution
Rajjix
Templates/posts.html != template/posts.html
Modou-dev
yeah sure
Modou-dev
but I still get the same mistake
Modou-dev
even if I change the name
Eugene
just rename folder template to templates
Eugene
it should be enough
Eugene
I hope
Rajjix
your changing stuff and sending new photos
Rajjix
i’m lost
Rajjix
send your view class ur directory tree and your setting if you played with ur templates dictionary
Modou-dev
is it about my post.html
Modou-dev
I have classe called (post)
Modou-dev
witch I have on column (text)
Rajjix
this is something else
Rajjix
First you need to find ur template
Modou-dev
it's my settings.py
Mirco
Stop sending screenshots or image files
Use pastebin pls 🙏
Modou-dev
Modou-dev
okay I see
Mirco
Modou-dev
duckduckgo 😂
Modou-dev
already done
Mirco
Whatever you want
Mirco
But use it, it's easier for everyone to help you better
Modou-dev
okay brother mine
Isaías
My problem and return the url image in django. Ex: www.teste.com/media/name image
Isaías
django rest.
Isaías
have lib?
ʚɞÇherry Łoveʚɞ
have lib?
no need other lib. only django-rest can handle.