Anonymous
Anonymous
doc example: >>> Author.objects.filter(name__unaccent__lower__trigram_similar='Hélène')
[<Author: Helen Mirren>, <Author: Hélène Joy>]
Mirco
Henrique
Mirco
Mirco
Mirco
@marcoscoder
I suggest you this read as well
“Full-Text Search in Django with PostgreSQL” https://medium.com/@pauloxnet/full-text-search-in-django-with-postgresql-4e3584dee4ae
Don't forget to thank @paulox 💪
Paolo
Thanks for sharing 👍
Anonymous
Anonymous
now, i have another error
Anonymous
django.db.utils.ProgrammingError: operator does not exist: character varying % unknown
LINE 1: ...toes_questoes" WHERE "questoes_questoes"."titulo" % 'Enin' O...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
query: >>> Questoes.objects.filter(titulo__trigram_similar='Enin')
Mirco
Anonymous
Extension created on PG ?
I think it's already installed, I've created classes in the application template. as in the doc https://docs.djangoproject.com/en/2.1/_modules/django/contrib/postgres/operations/#TrigramExtension
Anonymous
I tried to migrate but did not detect any changes
Mirco
Anonymous
Anonymous
in the doc there is a link to the psql doc but there is no info on how to create
Mirco
nope
Try to do that
I've shared you the read on Medium
Follow that
Anonymous
ok
Anonymous
its work
Anonymous
now, look: <QuerySet [<Questoes: 133 (Enem 2012 - Segundo Dia)>]>
>>> Questoes.objects.filter(titulo__trigram_similar='enen')
<QuerySet []>
Mirco
Is it working as you expected ?
Anonymous
by what I understood, when I type something like "ene" or "enen", it was to return the list containing "Enem" in the title
Anonymous
i think its because this "Now we have a different problem - the longer name of “Helena Bonham Carter” doesn’t show up as it is much longer"
Anonymous
oh, that's really what happens
Anonymous
>>> Questoes.objects.filter(titulo__trigram_similar='133 enen segumdo dya')
<QuerySet [<Questoes: 133 (Enem 2012 - Segundo Dia)>]>
Mirco
💪💪💪
Anonymous
also, thank you all for the help
Mirco
Yw 😀 thank to your issue, I've learned something new too 💪
Yamil
Hello good evening. I am trying to connect with to a server that has https, with that sentence: r = requests.post('https://example.com/Example/0.1/archivos/cargar', verify=False, headers={'Authorization': 'Basic XXXXXXXXXX='}, files=files) That error appears :
Yamil
('Connection aborted.', OSError("(104, 'ECONNRESET')",))
Yamil
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1638)
Yamil
TypeError: 'NoneType' object is not subscriptable
Yamil
Has someone already solved it?
Yamil
I am new with django. Thanks.
Tok
Is a type error... Review your code
Tok
I think that your request is empty
Yamil
I am using this : file = request.FILES['file']
handle_uploaded_file(request.FILES['file'], file)
ruta = '%s/%s' % (settings.TMP, file)
file = open(ruta, 'rb')
print(file.name)
Yamil
when I print the name of the file <_io.BufferedReader name='/home/yjorozco/workspace/FirmaEventos/sources/tmp/formato-permiso.pdf'>
Yamil
I tested the url with a javascript program and it works.
Anonymous
what is the "related_name" in the models? I read a little in the doc but I did not understand which usage I had found it was to use his name instead of using the model name in a relation.
None
None
Rajjix
from django.contrib.auth.view import LoginView as loginview
class LoginView(loginview):
form_class = UserLoginForm
template_name = 'user/login.html'
success_url = ''
authentication_form = UserLoginForm
Rajjix
LoginView Works fine when imported and used directly into my urls
but when i wanna add some stuff to it i get this error
Rajjix
__init__() got an unexpected keyword argument 'request'
Rajjix
File "/home/rajjix/Django/lib64/python3.7/site-packages/django/views/generic/edit.py", line 33, in get_form
return form_class(**self.get_form_kwargs())
TypeError: __init__() got an unexpected keyword argument 'request'
inchidi
Rajjix
path('login/', LoginView.as_view(), name='login'),
Rajjix
again when i import it directly from django.contrib.auth.views it works fine in urls but now when i import it from my views i get that error
inchidi
Rajjix
https://pastebin.com/XyWAMevc
Rajjix
Ye
Rajjix
It worked until i decided to bring in the LoginView to my views maybe add some functions
inchidi
better create custom authentication backend instead handle it in your form
inchidi
here is the sample
Rajjix
inchidi
by using this technique django will handle your authentication for you. the logic behind it is something like this:
>> authenticate() called
>> django iterate through all authentication backend
>> if fail to authenticate, use next auth backend
>> if success, return the user object
inchidi
so even if you have so many user type, maybe user can login just by token without providing username at all, or/and maybe user can also login with phone number also. all you need to do is register your auth logic there
Rajjix
I’ll be adding the custom authentication back end thanks for the feedback
Rajjix
But since your here if that doesn’t solve my request problem from the editview as shown above is it ok to just edit the source code and add a try except statement without that request in the __init
Rajjix
File "/home/rajjix/Django/lib64/python3.7/site-packages/django/views/generic/edit.py", line 33, in get_form
return form_class(**self.get_form_kwargs())
TypeError: __init__() got an unexpected keyword argument 'request'
inchidi
Rajjix
inchidi
Rajjix
I have time i’ll keep trying something gotta work ))
Rajjix
Thanks for the efforts master inchidi 🙇
None
Hello, I have a django project on wsgi server. I want to include django channels and to do it I should use asgi server. Will it work if I just change wsgi on asgi?
Piyush
Hi, I create the 3 services, one is oauth2 provider.. And two are clients. I am trying to implement openid connect so that I can get sso feature. How can I implement it??
Anonymous
Hello everyone
Anonymous
What is the best way to build django app on azure
Rajjix
https://medium.com/@__pamaron__/deploy-a-django-application-connected-to-azure-sql-using-docker-and-azure-app-service-a2c107773c11?source=userActivityShare-f344d1364a9b-1539322618
Anonymous
Yeah i read thiz
Anonymous
This*