m0nte cr1st0
Hello. Can you help me pls? https://stackoverflow.com/questions/60184652/why-dont-work-mocking-function-inside-another-fuction
Himanshu
how to can i handle csrf_exempt with the request.user.?
Himanshu
it shows me anonymous user..
Marcus
How to upgrade a legacy Django 1.3.7 / python2 app? Directly to 1.11? 2.2? 3.0?
cj
How to upgrade a legacy Django 1.3.7 / python2 app? Directly to 1.11? 2.2? 3.0?
you have to rewrite a loooot of code, but really a looooooooot of code
Alex
you have to rewrite a loooot of code, but really a looooooooot of code
Not necessery. It depends on what django features were used in the project. I've made it like this - cover the critical parts of the project with tests and then simply upgrade django and fix all the errors.
cj
well... as it's from Py2 and Django 1.3.7 to Py3 and Django 3.0, I don't think if it's gonna be simple, maybe it if was from Py3 already and Django 1.11 to Django 3.0 then yes it maybe simple 🤷🏻‍♂️
Alex
Hm, yeah. I've fucked up and skipped that part with python 2.
Marcus
So , first step might be migrating to 1.11, then py2 to py3, then Django 2 from there.
Alex
Yes, I think it would be a good roadmap - migrate to python 3 first.
Marcus
Or just rewrite the whole thing.
cj
🤔 from Django 1.3, just start migrating to the latest Django version that supports Py2, I guess it was 1.11
cj
then when you're on Django 1.11 with Py2, migrate it to Py3
cj
then when you have things working on Py3 and Django 1.11, migrate to Django 3.0
Marcus
lots of work ahead
cj
Or just rewrite the whole thing.
if it's easier for you to rewrite everything from scratch on Py3 and Django3, then don't lose time migrating, and rewrite everything
Alex
lots of work ahead
I would like to give a small advice - make a look on how modern middlewares are written. This django part got changed significantly.
Batman
Hey all, what packages or implementation do you guys usually prefer when providing search in your django project?
Batman
search of what? Text?
oh yeah, and even full text search at that
Alex
oh yeah, and even full text search at that
In one of my prev project we use elasticsearch for fulltext search. The idea is that you grab your data that you want to be searchable that way and upload them there. It supports many features and languages.
Alex
Postgres supports FTS "out of the box" as I know, but never have used it.
Batman
i have tried the full text search support that postgres contrib provides but I wasn't really able to figure out how to build the correct indexes to optimise its speed
Batman
elasticsearch hmm, what package did you use? django-elasticsearch-dsl?
Alex
elasticsearch hmm, what package did you use? django-elasticsearch-dsl?
It's a long story to tell. At first it was haystack but then it turned out that the package is abandoned so I switched to python's elasticsearch client and its extention - elasticsearch DSL.
Alex
i have tried the full text search support that postgres contrib provides but I wasn't really able to figure out how to build the correct indexes to optimise its speed
I remember that django main site uses postgres for FTL as well so you could simple inspect their code for inspiration.
Batman
btw have you tried django-watson?
Modou-dev
hello how can I test this class : class NfcView(viewsets.ModelViewSet): @action(detail=False, methods=['post'], url_path='register_customer', name="agent") def agent_nfc_register_customer(self, request):
Alex
yeah i digged up a little about and it seems to only support elasticsearch v6.0
No, it doesn't https://django-haystack.readthedocs.io/en/v2.8.1/backend_support.html
Alex
Hm, or they just forgot to update their docs. Anyway, I don't recommend to use that pack.
Felipe
Hey guys, I have a problem to solve. I'm using Django and DRF and I have a date field that must have just day and month, not year. If I use the date field raise an error for missing year. Do you guys know some lib that takes care of this, or has you guys some idea of how can I deal with this case? Thx!
Anonymous
When creating forms from Django. The name of the variable is displayed on the site. How can I change the name on the site without changing the variable. Without html
ᶜᵒᵐᵐᵃⁿᵈˡᶦⁿᵉ
which is latest 2.2.10 or 3.0.3?
ᶜᵒᵐᵐᵃⁿᵈˡᶦⁿᵉ
because when i install pip install django, by default it installs 2.2.10, why?
Anonymous
which is latest 2.2.10 or 3.0.3?
I think pip installs the 'stable' release.
cj
I think pip installs the 'stable' release.
yes, and by the time this is being written, it's 3.0.3
Anonymous
any suggest me best tutorial on django rest framework i really want to learn
cj
any suggest me best tutorial on django rest framework i really want to learn
the official tutorial of django rest framework, it's very good
Alex
any suggest me best tutorial on django rest framework i really want to learn
Here you go kid! https://www.django-rest-framework.org/tutorial/quickstart/
Anonymous
thank youcan you provide me the resource link
Anonymous
thanx alex
PV
https://pastebin.com/YvynsYq5
PV
Please check
Alex
Please check
!readscreen
Alex
It seems that that message = generate_form_errors(form,formset=False) doesn't support json serialization of it self.
PV
But I don't see any non-serializable data there, I have updated pastepin with post data
Alex
But I don't see any non-serializable data there, I have updated pastepin with post data
> But I don't see any non-serializable data there File "/usr/lib/python3.5/json/encoder.py", line 179, in default raise TypeError(repr(o) + " is not JSON serializable") TypeError: ValidationError(['This field is required.']) is not JSON serializable
Alex
You are passing an instance of ValidationError there
PV
It comes from jQuery validation
ᶜᵒᵐᵐᵃⁿᵈˡᶦⁿᵉ
try to pip install --upgrade pip
yea i did its still 2.2.10
Alex
yea i did its still 2.2.10
did you uninstall django before to try to install the new version if there is? If not, you then should pip install --upgrade django
Anonymous
can i make a like button by django?
Krunal
How to deploy Django app on windows iis10
Alex
How to deploy Django app on windows iis10
google deploy Django app on windows iis10
ᐯᑌᏞᏦᗩᑎ📈
what is the difference between OneToOneField and ForeignKey?
Doragonsureiyā
what is the difference between OneToOneField and ForeignKey?
Step 1: Open a browser Step 2: Write down https://google.com or https://duck.com and press Enter Step 3: In the search box write down the same words you asked here Step 4: Read the firsts results
ᐯᑌᏞᏦᗩᑎ📈
thank you bot😇
Luis
Hi guys, question ? What data type should I use for a parameter of a function if I want that parameter to be one value of list of values
Luis
?
Luis
And for being more precise I want that parameter to be one of this values
Luis
METHODS = ( (1, 'FRENCH'), (2, 'GERMAN') ..... )
Alex
METHODS = ( (1, 'FRENCH'), (2, 'GERMAN') ..... )
If you REALLY need the answer: 1 Don't write like this. Don't spam messages. 2 Elaborate your question. I even not sure if it is related to django at all.
ᶜᵒᵐᵐᵃⁿᵈˡᶦⁿᵉ
is their ant way to add drag and drop functionality in my page? without using using HTML in it? some django module?
ᶜᵒᵐᵐᵃⁿᵈˡᶦⁿᵉ
yes😅