Shikhar
Orack
If i want to implement a google drive/ dropbox sync kindof thing like click sync button, all files on local pc would be uploaded to server including directory structure. And if i delete something, that should be deleted from server too. what would be its approach in django ?
Shikhar
Anonymous
Just created a registration page thats saving data to the database, but am stuck at logging in with the created data. Someone should help me
Anonymous
Rounak
Rounak
But i dont have knowledge of javascript bootstrap jquery
Yanik
For working with django. Try to learn Python's basics first
Rounak
Yes I knw it... Python basics
Rounak
Then what I will study?
Yanik
And then move on to learn work structure of backed
Yanik
Backend*
Rounak
Yanik
How actually backend work this will take almost 1-2 hrs to learn
Yanik
Yes learn Python
Yanik
And dive into django for web
Remy
so, using Jinja with django is kinda redundant and useless 🤷🏻♂
A little late to the conversation, but actually jinja2 is also inboxed by default in Django. See this quote from the documentation:
> The built-in backends are django.template.backends.django.DjangoTemplates and django.template.backends.jinja2.Jinja2.
Remy
I catched up with this thread, all at once, more than 3K unread messages.
Remy
I have to say that there is a lot of "noise" lol
Remy
Many messages such as: "hey I need hlp plz system dont work how should I do PLEASE NOW"
Remy
Anyways,
Remy
Question for the advanced Django players here (@izznogooood, @c0x6A, @LuchoUY, any other qualified?)
What solution would you see to somehow allow a frontend build system (webpack or gulp), to use the django templates to render static pages?
In other words, you have django templates in your project, that make use of models and stuff, they are already implemented. They already work fine, on Django's runserver.
However, In top of that, I want gulp/webpack to watch those SAME files, to render them in a separate local webserver, somehow ignoring the {% for item in items %} and other dynamic content, or having default hardcoded ones.
Remy
The result of having such a system is that a non-django developper could run the templates and look at them / work on their markup without knowing anything about django, without having a local database: just a full STATIC project.
Remy
I'll re-ask for input later in here in case it goes un-noticed 🙂
Ильяс
How to Inherit field from one model to another model
Ильяс
?
Ильяс
Anyone?
raven
raven
are you using axios? for making request?
.
pass csrf token in your header.
If I enable only token authentication, django bydefault disables csrf protection. So I added csrf_protect method decorator on unsafe method requests.
raven
raven
By default its on for each view unless you exempt it
raven
i didn't know that.
.
after adding that decorator it is raising csrf token missing error.
.
raven
raven
raven
server always sends csrf token
raven
wait I'll send you something
raven
https://docs.djangoproject.com/en/2.2/ref/csrf/
raven
in this there is getCookie method
raven
django mentioned how to send csrf token in request header
.
i didn't know that.
Do you know, Does django generate a new token after using previous token in unsafe method?
raven
i don't but i know how to implement token based authentication
raven
😅
.
raven
yeah
raven
.
Like if a csrf token was checked in a post request. In response to that request django sets a new csrf cookie
.
yeah
Its not unique per session...its unique per request. It that correct?
Anders (izzno / gooood) 🇳🇴
Question for the advanced Django players here (@izznogooood, @c0x6A, @LuchoUY, any other qualified?)
What solution would you see to somehow allow a frontend build system (webpack or gulp), to use the django templates to render static pages?
In other words, you have django templates in your project, that make use of models and stuff, they are already implemented. They already work fine, on Django's runserver.
However, In top of that, I want gulp/webpack to watch those SAME files, to render them in a separate local webserver, somehow ignoring the {% for item in items %} and other dynamic content, or having default hardcoded ones.
I think your overthinking this. Why don't you make a dummy site in docker-compose with everything the site needs then you can just run the dev server inside letting him see the changes live. For a front end dev to understand the core things of Django templates is easy. Like her comes x amount of this or show this if user is logged in etc...
Anders (izzno / gooood) 🇳🇴
You can use the dumme site for development as well...
Anders (izzno / gooood) 🇳🇴
I use scripts to import the current dB in to my dev site from Tim to time so the dev stages are like a full circle.
Dev-stage-master the import back to dev (db)
Anders (izzno / gooood) 🇳🇴
(and I am am not a professional (Django only) dev 😊, but I think mirco is)
Guillermo
someone uses saleor pwa storefront in production?
R
Question for the advanced Django players here (@izznogooood, @c0x6A, @LuchoUY, any other qualified?)
What solution would you see to somehow allow a frontend build system (webpack or gulp), to use the django templates to render static pages?
In other words, you have django templates in your project, that make use of models and stuff, they are already implemented. They already work fine, on Django's runserver.
However, In top of that, I want gulp/webpack to watch those SAME files, to render them in a separate local webserver, somehow ignoring the {% for item in items %} and other dynamic content, or having default hardcoded ones.
If I understood it good, I dont see an easy way to achieve this if you want to use the SAME templates, maybe you could play with verbatim template tag or create a specific template tag which allow to encapsulate a block to ignore and provide a default value which the front end dev would provide, but the frontend dev should anyways learn where he should put the default code snippet and deal with lots of verbosity. Additionally these extra template logic would also need to be processed in production which could decrease a bit the performance
R
R
Related to template engines, not sure if its an stupid idea but recently I have been dealing and experimenting with vuejs, I really like it but having to deal with a django project for the API and a vue one with SSR for getting good SEO I think is a mess for some small projects and was thinking that maybe it would be possible to create a dropin replacement for django template language where you pass the django context object as vuejs data and then compile all the template from django with vuejs instead of DTL (similar to what nuxt does but from django). Any impressions/ideas/problems you could see about this?
Anonymous
how can i notify the user that they entered incorrect password . i use django authentication and i think the name of error message is not
messages
. how can i notify then the user incorrect password or username errorr?
R
Anonymous
then what is the name of that variable or class name .i mean if i myself have an authentication function i do like ```def authenticate (request):
...
...
messages.error(request,'You entered incorrect ps....')
Then i can access the message just by messages throgh for loop
Anonymous
but i dont know the builtin django auth
Anonymous
thank you very much i was on this page but i didn't notice this
Anonymous
.
pls send information model details
Shikhar
Remy
Anders (izzno / gooood) 🇳🇴
Anders (izzno / gooood) 🇳🇴
Django / gulp / webpack is a rabbit hole...
Anders (izzno / gooood) 🇳🇴
I mean mount a folder for your dB and keep it versioned so whenever you run the dev env you have a db.
How do you develop now?
Remy
Well, separate them. Build a Django graphql backend and let the front end do exactly what they want.
Yeah that's often the way it's done, having a full front-end project separated working as a SPA, and consume your backend through DRF. (As in my reply to Roger). But I find it quite overkill to let javascript manage the routing. I mean it's so easy to do that with Django's urls, and many pages don't need a hight reactivty, sometimes you just want to show a regular html page (like for the privacy policy of the website or something). So why having this whole big javascript managing everything, when you can just use it on some strategical places. That's why I try to use Django as much as possible
Remy
I don't trust too much frontend libraries. They change too often. You have to re-learn everything too often. It's much more safe for me to use Django whenever I can and not take up too much on the frontend hottest framework hype.
Remy
I did that in the past, I built a whole Angular1 app, which is now good for trash because support was dropped lol
R