Live data from Hacker News

Django 2.1 released

docs.djangoproject.com

41–50 of 129 posts

Re: Django 2.1 released

#41

To django model users. Can you query keys inside a JSON datatype(pgsql)[0] from the ORM? For example in sqla you will do: records = db_session.query(Resource).filter( Resources.data["lastname"].astext == "Doe" ).all() with data being the json column and lastname a key in the column. [0]: https://stackoverflow.com/a/29975187

Django's version of that query (to me) looks a little neater too. records = Resource.objects.filter( data__lastname__exact="Doe" )

One can also write the sqla query as:

    Resource.query.filter(
        Resources.data["lastname"].astext=="Doe"
    )
Personally I find the "__" convension strange and not sure that it would be obvious to new comers that you are accessing a key in the data column.

Re: Django 2.1 released

#42
post #7

I've been working with Django for almost my whole career, since 1.1. It's a joy to use, and blows any other web framework I've used out of the water when it comes to actually just building stuff. Django is a fantastic boring[1] tool, and seeing boring updates like this is great. 1: http://mcfunley.com/choose-boring-technology

[deleted]

Re: Django 2.1 released

#43

Earlier quoted context omitted.

Not OP either, but I've been using Django REST framework with React.js, and I'm really enjoying it.

Any tips for how to use JWT authentication and get around CSRF tokens being in forms when combining DRF with a JS SPA UI?

If you want JWT, you can use https://github.com/GetBlimp/django-rest-framework-jwt -- that provides another authentication class, and you can then auth with `Accept: Bearer `.

If you don't need JWT (I'd probably leave it out next time round) then Django Rest Framework comes with a simpler bearer token auth class (among others): http://www.django-rest-framework.org/api-guide/authenticatio....

edit to add - if you're asking specifically about sharing sessions between the JS app and the Django server-side form, I believe this is what you're looking for:http://www.django-rest-framework.org/api-guide/authenticatio..., i.e. you'll still need to pass the csrf token into the JS app.

Re: Django 2.1 released

#44
For anyone thinking about picking up Django and is worried about the framework being obsolete I encourage you to take a look.

Django is fantastic. I've worked with it for a number of years now and it can really help in the early stages of prototyping.

Things I especially like about Django:

* The built in admin letting you edit and view objects easily.

* Being able to use it without using the views. Add django rest framework and you can model your domain with good REST practices.

* Migrations and works well with postgres.

* That the team has thought a lot about web security and how to implement it. Things like XSS, CSRF, CORS, session timeouts, authentication are all there in Django. Other frameworks I need to pull in a library for each and pray that they work well together. I found this especially with Flask and large projects it gets ridiculous how much I have to write from scratch.

Things that would make me not choose Django:

* If you have a graph style problem and need a graph database like neo4j. (Even then I'd probably want some part relational)

* If you accept lock in to someone else's platform like firebase and don't want to run your own servers.

* raw speed is an issue and you are okay with development taking much longer. In that case you're looking at some of the golang frameworks and possibly node/express.

Re: Django 2.1 released

#45
post #7

I've been working with Django for almost my whole career, since 1.1. It's a joy to use, and blows any other web framework I've used out of the water when it comes to actually just building stuff. Django is a fantastic boring[1] tool, and seeing boring updates like this is great. 1: http://mcfunley.com/choose-boring-technology

As a counter point, I tried to use Django for a data-visualisation project and ran into some problems. Everything is built on models, which are kind of activerecord pattern. Django has an inbuilt (and inferior) version of sqlalchemy, so that when you want to push sql past a certain point (define queries more complex than the api) you're pretty much stuck. Now you have codebase with two different database libraries in…

I don't disagree with your assessments of django limitations. It does however, seems like a poor choice for your specific problem.

This is why the problem inform the solution, pick the framework (or lack of) that suits your problem best

Re: Django 2.1 released

#47
post #7

I've been working with Django for almost my whole career, since 1.1. It's a joy to use, and blows any other web framework I've used out of the water when it comes to actually just building stuff. Django is a fantastic boring[1] tool, and seeing boring updates like this is great. 1: http://mcfunley.com/choose-boring-technology

My roommate in College built a site with 0.96 of Django. It’s still running.

I think it’s one of if not the longest running commercial Django websites.

Re: Django 2.1 released

#48
post #44

For anyone thinking about picking up Django and is worried about the framework being obsolete I encourage you to take a look. Django is fantastic. I've worked with it for a number of years now and it can really help in the early stages of prototyping. Things I especially like about Django: * The built in admin letting you edit and view objects easily. * Being able to use it without using the views. Add django rest fr…

Why would anyone consider it obsolete to begin with ?

If anything, I would consider someone making that statement miss informed

Re: Django 2.1 released

#49
post #44

For anyone thinking about picking up Django and is worried about the framework being obsolete I encourage you to take a look. Django is fantastic. I've worked with it for a number of years now and it can really help in the early stages of prototyping. Things I especially like about Django: * The built in admin letting you edit and view objects easily. * Being able to use it without using the views. Add django rest fr…

Why would anyone consider it obsolete to begin with ? If anything, I would consider someone making that statement miss informed

In the current web dev world, "not the hip new paradigm of the past 3 years" == obsolete in some people's eyes, sadly.
Post reply on HN