Aadhi
Anybody knows how we can pass the values from JavaScript to our views.py function???????
Ronald
Anybody knows how we can pass the values from JavaScript to our views.py function???????
https://docs.djangoproject.com/en/2.2/ref/request-response/
Muslim
Sorry:D
Alexander
do not use jQuery, it's legacy
Alexander
Alexander
and use this dev image in your PyCharm
Anonymous
Hi friends, is any one can help me to understand how change lazy urls resolver : myapp.super.urls to dynamic.
Mirco
Ajax
JavaScript now has Fetch APIs
Juris
Quick question. I have the infamous "AppRegistryNotReady("Apps aren't loaded yet.")" 'django-admin check' returns : django.core.exceptions.ImproperlyConfigured: Requested setting LANGUAGE_CODE, but settings are not configured.
Juris
The app is in the INSTALLED_APPS.
Juris
Seems that timezone code was the problem :|
Jimmies San
The app is in the INSTALLED_APPS.
Requested setting LANGUAGE_CODE, but settings are not configured
Juris
Language code was set. Despite the error message, changing the timezone (I had it set to UTC+1, changed to GMT+1) was what helped. LANGUAGE_CODE was and still = 'en-us'
Juris
There _may_ have been an indentation issue along the way :P
Juris
Thanks for your response.
Ronald
do not use jQuery, it's legacy
jQuery isn’t legacy. It’s still being maintained and updated.
Jimmies San
jQuery isn’t legacy. It’s still being maintained and updated.
but it's a cancer: so better to avoid it.
Ronald
but it's a cancer: so better to avoid it.
fair enough. ES6 makes things a lot easier. But jQuery still got it’s place.
Jimmies San
fair enough. ES6 makes things a lot easier. But jQuery still got it’s place.
for me the dom manipulation is a wrong approach. databinding is the way
Ronald
for me the dom manipulation is a wrong approach. databinding is the way
I mean.. if you’re building an app in React / Vue + django rest framework, then yes dom-manupulation is a no-go-zone cause virtual dom. But when you’re dealing with say a full stack Django app with Jinja templating and stuff, jQuery is still common practice, even as per django’s documentation (eg, CSRF examples all use jQuery).
Alexander
today js-developers use Angular, React and Vue.js, so..
Alexander
there is no place for jQuery in new projects
Alexander
it was nice lib for DOM manipulation (for old browsers without ES6 support)... but today you can not set secure TLS settings AND support old IE < 11
Alexander
also check good design of Django projects: https://github.com/phalt/django-api-domains no forms, no templates, Django as API generator (RESTful API and/or GraphQL API), models, services (hello, DDD), apis and interfaces
Alexander
this is about how new Django-based projects should be created in modern way in 2019
Alexander
and, yes, docs on Django site are outdated, they may contain some examples of using jQuery etc. it is 2008-2010-way, not 2019-way of doing things...
Doug
and, yes, docs on Django site are outdated, they may contain some examples of using jQuery etc. it is 2008-2010-way, not 2019-way of doing things...
jQuery still has a place within js development. It's ok if you don't understand where it lives but don't knock those who still use it. Sometimes you don't need a full frontend library like react or Vue and just need simple dom manipulation. Until es6 is full standard jQuery will always have a spot.
Shreehari
hello guys , has anyone tried deploying django based website on github.io ?
Shreehari
coz i dint get how to do it.
Shreehari
and its free too
Shreehari
can you please share a guide to understand it?
Jimmies San
only static websites
Shreehari
ohhk thanks
Shreehari
👍
Jimmies San
if you need a free hosting for your django app
Jimmies San
try pythonanywhere or heroku free
Jimmies San
but it's limited
Shreehari
no problem , its just for learning purpose
Shreehari
thanks for the info
Jimmies San
💃💃💃
Juris
Does pythonanywhere / heroku have significant advantages over AWS deployment?
Jimmies San
Jimmies San
and aws wants you r credit card to take the free plan: if you do something wrong the billing goes up and you're fecked :D
Alexander
jQuery still has a place within js development. It's ok if you don't understand where it lives but don't knock those who still use it. Sometimes you don't need a full frontend library like react or Vue and just need simple dom manipulation. Until es6 is full standard jQuery will always have a spot.
yes, jQuery is one of the most popular js libraries, we will see it in many projects may be even in 2030 or 2040. And same with Windows XP 😊 somewhere people will use it but if you are not newbie, you should not use jQuery for new projects (and install Windows XP too) if for some reason you need do something with DOM, check https://lit-html.polymer-project.org/ (if you think that web components may replace Vue.js/React it's your choice) or https://www.w3schools.com/Js/js_htmldom_elements.asp
Alexander
[link to lit-html from interesting article about future of js-frameworks https://www.dannymoerkerke.com/blog/web-components-will-replace-your-frontend-framework]
Alexander
putting people down? hmm... I just tell about Windows XP and jQuery are not for modern web, it is not for 2019 year) they were good but now it's history) if you are professional developer, you should not use them because of there are better ways...
Alexander
where did you see "putting people down" here? if you are newbie (junior developer), you select any way to solve your problem, it's okay if you are middle or senior - you should prefer best available way, jQuery is not the best way in 2019
Alexander
On official Django site you can read The web framework for perfectionists with deadlines. I mean, perfectionists will never use jQuery in new projects in 2019. Perfectionists will try to kill jQuery in all projects (if perfectionist has time for this). Ask JavaScript senior developers about their jQuery opinion if you do not believe me, some of them neutral to jQuery, some of them hate jQuery.
Doug
👍
Mirco
👍
Imho @lorddaedra don't want to let yourself change the technologies your wanna work with He's just saying that some technologies about js are changing to help ya build something better If you don't wanna trust him, trust GitHub or even bootstrap , GitHub has totally removed jQuery from their entire codebase and bootstrap has an open PR to remove it as dependency , so if u like bootstrap , when 5.x.x version will come you probably won't see any jQuery including lines
Mirco
Anyway we are a bit offtopic so come back on Django stuff 😁
Alexander
Anyway we are a bit offtopic so come back on Django stuff 😁
Django use jQuery as part of admin app [so there is relation between Django and jQuery, it's not offtopic here]
Mirco
Django use jQuery as part of admin app [so there is relation between Django and jQuery, it's not offtopic here]
Of course, but we're focusing on jQuery and js stuff , not how Django uses jQuery
Alexander
Of course, but we're focusing on jQuery and js stuff , not how Django uses jQuery
there is relation, as moderator of russian django group (@pydjango) I see many questions in chat about templates, form and other things... Juniors read official docs and think that they should use Django Templates (yes, with jQuery and other libs may be) instead of creating API-based project... docs suggests some stable but old 😞 way of doing things... more people read modern articles about modern web -> then more of them will use API -> then more of them will ask about "why do Django admin still use jQuery?" or ".. do not use modern frontend frameworks?" so if we would like to make good future for Django - we should educate people about how to create modern web projects, deprecation of jQuery and moving to modern js-frameworks increase focus on API generators for Django modern web for backend frameworks like Django, future of Django - it's way of API-generator, more people hate jQuery -> more focus on Django as API generator, so there is relation between "how people do their frontend part" and "future of Django"
Alexander
👍🏻 If you wanna make docs better, you can always open a PR about some documentation update according to nowadays frontend tech I'm sure, everyone you wanna help will thank ya 😊😊
I have some point of view and I think Django developers should know about it because of it may be important for Django future. My point of view may be not clear for people who create simple websites on Django or who prefer good old stable way with jQuery. I'm sure there is no good future for MVC frameworks, all MVC frameworks will find their new role (as API generators) or will die 😞 as popular projects, so if we like Django and would like good future for Django, we need somehow focus community on Django as API generation framework and for frontent tasks - suggest go to Vue.js (or may be /React/Angular/etc.) website and start new Vue.js project via vue-cli instead of using classic MVC way with html and jQuery in templates on Django side if Django will not focus on API generation as primary role, it will lose users who create projects harder than "CMS-like" or "e-commerce", in my opinion Django is something more than "Wordpress with plugins on Python" so I think it should be clear for Django developers... It's just my opinion, but you may check a lot of articles on Medium etc. with same idea: modern project = backend with API in containers (on Kubernetes / Nomad / etc. cloud) + Vue.js / React / Angular / anything-else based frontend in separate git repository... So really this questions are not about docs, it's about ideology. Django as MVC framework -> Django as API generator [with ability to create MVC project]
Michail
i am using drf. how i can provide a Create item endpoint to be available for non authorised while Read/Delete only for admin ? i need it for creating external API hook
Michail
A custom permission class maybe?
do you maybe have any reference or example ?
Alexander
Alexander
also you can integrate with services like Auth0 (OIDC) and use their RBAC system and check roles/scopes on Django side
Guillermo
do you maybe have any reference or example ?
Not right now, sorry, but the drf docs about permission classes should have that info
Alexander
do you maybe have any reference or example ?
do you use JWT tokens? if yes, it may contain scopes and your permission class will read it and check if it contains read and delete for items
Alexander
https://auth0.com/docs/scopes/current/api-scopes
Alexander
well, then follow permissions guide on django rest framework website
Alexander
about modern way of doing this things: Django - is just 'resource server', there is API Gateway between resource server and user there are many 'hard ways' (expensive and hard: need skills and money to use it) I know some cheap or free ways and can share: 1. https://gravitee.io/ Auth + API Gateway. free 2. Caddy webserver with plugin https://github.com/BTBurke/caddy-jwt/blob/master/README.md free, but you need generate JWT via Keycloak (free) or Django or Auth0 (free or cheap SaaS) etc. [you may also check Okta, AWS Cognito as Auth0 competitors]
Alexander
so in ideal world (for perfectionists) you should not check permissions and do auth-related things on Django side, Django is only API generator around your PostgreSQL and business logic
Anders (izzno / gooood) 🇳🇴
Anders (izzno / gooood) 🇳🇴
All shortcuts come at a cost. Either its a cost of skill or a cost of money does not matter...
Anders (izzno / gooood) 🇳🇴
Every tool has it advantages. For me (and I can only speak for my self) Django is an incredible prototyping tool which I've noticed I (others) keep if you need its extensive admin tooling.
Anders (izzno / gooood) 🇳🇴
I can only imagine the power it holds if you ise Django and only Django all the time..,.