18 ms·
Django 2.1 released
- collinmanderson 8y agoRelease notes here: https://docs.djangoproject.com/en/2.1/releases/2.1/ https://docs.djangoproject.com/en/2.1/releases/2.1/
- blorenz 8y agoCongrats Django team! This iteration doesn't add too much for my current workings with the framework but it matures it none-the-less. My usual project compositions utilize Django, GraphQL, and React. I'm earnestly watching https://www.aeracode.org/2018/06/04/django-async-roadmap/ https://www.aeracode.org/2018/06/04/django-async-roadmap/ to hopefully work it's way into the near future releases.
- StavrosK 8y agoFantastic work! After the last few feature-packed releases, I'm happy to see a bugfix one. Upgrading should be a breeze.
- Alex3917 8y agoAfter running my test suite, I'm seeing zero deprecation warnings (let alone failures) in 2.1. I'll still wait a couple months before upgrading in production, but this should be one of the easiest upgrades in a long time.
- blorenz 8y agoAgreed, or you end up with something that resembles the unfortunate path of iOS. I'm in the Apple ecosystem so this isn't an attack from an opposite camp, but a matter-of-fact cautionary tale about the kludge which has appeared when components have become untenable and not-so-great performance related.
- theptip 8y agoRead-only model views are a great addition to the Django admin -- I've been watching that PR for a long time, glad to see it land. This will make it a lot easier to build internal admin dashboards that are safe to share with non-privileged users like support staff.
- keshab 8y agoI have seen a bastardized version of Django admin used as a quite sophisticated dashboard. This new addition will make it even easier to hack together things like that in a very short time.
- dopeboy 8y agoThis is a surprisingly pretty common practice. I know people, even at Google, who want the ease of CMS but additional control.
- paganel 8y agoOne of my first Django projects was to “bastardize” its admin into a Lead/Opportunity management system for a mortgage broker, back in the version 0.96 days. I know that monkey-patching is now frowned upon and reguarded as “the work of the devil” but it really helped me get the job done for that project in a pretty reasonable amount of time. I hope dynamic programming makes a come-back.
- mrfusion 8y agoThere were always ways to get read only in the admin. Just not nicely. It shouldn’t have been holding you back though.
- CJST_ 8y agoI've been looking forward to this as well. A lot of developers underestimate the time it takes to build CMS and resource dashboards (even small ones).
- fredley 8y agoI'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 http://mcfunley.com/choose-boring-technology
- blackrock 8y agoWhat do you use to write your front end Javascript?
- anchpop 8y agoDjango fan here, if you're trying to use Django with react you may be interested in this: https://github.com/anchpop/cookiecutter-django https://github.com/anchpop/cookiecutter-django I wrote it for my own convenience but others may find it useful.
- deleted 8y ago[deleted]
- johnthedebs 8y agoNot OP, but I've also been using Django for (more than) my whole career and I use React on the frontend. If you're curious about the frontend path I took, it was roughly: * jQuery with no framework * Backbone (for a couple years) * Backbone + Marionette (for a couple more years) * Angular (for about a week) * React (for the past few years)
- paulhallett 8y agoDjango is the only web framework where I see consistently positive discussions about it on HN. Bravo Django, and congratulations on another release!
- parvenu74 8y agoThis aspect has me looking at getting into Django; what have the discussions on HN regarding ASP.NET Core (the new open-source stuff) been like? I'm mainly in pre-Core MVC and looking to move up to something I can deploy to any Docker-hosting environment.
- undseg 8y agoI can't help you with ASP.NET Core, as I have no experience building and/or deploying it. What I can chime in with though is: In my days as a web dev I started off and learned the ropes with ASP.NET (MVC was recently coming up), and after moving to django for another project I felt right at home. It's very impressive how the django project was able to rival a behemot like Microsoft in terms of usability, reasonable defaults and developer convenience, overall design, documentation, upgradability. The REST stuff (django rest framework) and some aspects of managing models were actually quite ahead of ASP.NET at the time for getting you up to speed with things. Of course the tech stack around them is completely different and something you'll want to think about, but in terms of features and how things are laid out you don't need to worry, django has you covered.
- brightball 8y agoAre there any good reads on Django for former Rails devs? I'm learning Django now and interested for the "translation".
- appleiigs 8y agoTango with Django is my favourite read but it’s tutorial style.
- richjdsmith 8y agoI am the same. Not because I want to stop using Rails (I <3 Rails), but rather just to increase my repertoire. Let me know if you find something!
- oneweekwonder 8y agoTo 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 https://stackoverflow.com/a/29975187
- akx 8y agoSure you can. See the documentation: https://docs.djangoproject.com/en/2.0/ref/contrib/postgres/fields/#querying-jsonfield https://docs.djangoproject.com/en/2.0/ref/contrib/postgres/f...
- oneweekwonder 8y agoThank for the quick reply. Now I need to understand how the "__" magic work; And I wonder what would django do if my key is "animal__breed". Will it understand: Dog.objects.filter(data__animal__breed='collie') But this is maybe questions I should rather ask on #django or stackoverflow.
- strig 8y agoDjango won't let you name a model field with a double underscore, I believe. Not sure how this would work with a Postgres JSON type column though, but it would probably throw an error.
- akx 8y agoYou probably simply can't do a `data['animal__breed']` query (not with that syntax anyway; you can implement custom lookups though) if your key happens to contain a double underscore.
- kennydude 8y agoDjango's version of that query (to me) looks a little neater too. records = Resource.objects.filter( data__lastname__exact="Doe" )
- jtchang 8y agoFor 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.
- OmarGonzalez 8y agoWhy would anyone consider it obsolete to begin with ? If anything, I would consider someone making that statement miss informed
- meowface 8y agoIn the current web dev world, "not the hip new paradigm of the past 3 years" == obsolete in some people's eyes, sadly.
- Alir3z4 8y agoI would consider that person to be obsolete :D
- paulddraper 8y agoThere are not currently many well-known products that use it. (Bitbucket cloud being the exception.) That's not the best of reasons; just because Django is not used by Google doesn't mean it isn't the perfect tool for you.
- appleiigs 8y agoA reminder to support these guys! 24% funded and they’re only asking for $200K. :( https://www.djangoproject.com/fundraising/ https://www.djangoproject.com/fundraising/
- frankwiles 8y agoThank you for bringing this up!
- Alir3z4 8y agoThanks for mentioning. I was going to post that I see you did it already. Such a heavy mega framework that small to big companies and individual relies on, we should support it. Whoever sees this, please support Django to reach its goal.
- dopeboy 8y agoI work with a lot of clients and for every project, it's Django. I love how readable the code is. I've even had non-technical clients peer into the code and make correct observations. And it's been said already, but Django Admin is a crown jewel. I can't tell you how many clients have jumped with delight when they realize they get that functionality out of the box. It ends up turning into a great admin dashboard and pseudo analytics tool---atleast for the short term. If you're jumping on the GraphQL train, I'd encourage you to check out Graphene. It's a Django library that serves as a GraphQL provider. Reasonably well documented and production ready, IMO. If you're looking a Django + GraphQL + React starter project, mbrochh's project [0] is a good place to start. It is slightly outdated but the core patterns are still reusable. [0] - https://github.com/mbrochh/django-graphql-apollo-react-demo https://github.com/mbrochh/django-graphql-apollo-react-demo
- trevor-e 8y agoCan anyone recommend a framework like Django except for a static language? I tried Django and really liked what I saw, but I can't see myself using Python for a large project.
- collinmanderson 8y agoThere's been some work to add type-hinting to Django if that helps. Check out: https://github.com/TypedDjango/django-stubs#django-stubs https://github.com/TypedDjango/django-stubs#django-stubs https://gitter.im/mypy-django/Lobby https://gitter.im/mypy-django/Lobby
- scns 8y agoGobuffallo.io the guy who wrote gave a talk which you can find on youtube.
- lowercased 8y agoOpen question re: django: https://docs.djangoproject.com/en/2.1/ref/models/fields/#null https://docs.djangoproject.com/en/2.1/ref/models/fields/#nul... I've got a colleague who has been using django for a couple of years (and has 15+ years experience with python outside of web, as well as java, php, arduino hacking, 3d printing, etc). He pointed me to the link above re: nulls - I can't figure out why the default would be to convert a null to an empty string. All major databases can understand nulls just fine. "... If a string-based field has null=True, that means it has two possible values for “no data”: NULL, and the empty string. In most cases, it’s redundant to have two possible values for “no data;”..." An empty string is "no user supplied data" and a null is "no value has been given at all". It seems rather ... odd(?) to try to conflate the two. Am I missing something? I've got perhaps a slight bias against django, in that the only people I've known who've used it were either junior devs who had no experience in anything else (and raved about it), or senior folks who've inherited a relative django mess (usually the result of the aforementioned junior devs).
- caspar 8y ago> An empty string is "no user supplied data" and a null is "no value has been given at all" I assume you meant "an empty string is user supplied an empty string as data". That aside, you wouldn't normally switch that option on for a field (notice the default is false). However, Oracle DB stores empty strings as indistinguishable from NULLs[0], so an ORM supporting Oracle DB may want to have some support for converting "empty or null" to an empty string at read time (notice the Oracle specific caveat in the docs in your link). Once you have that, I'd guess the thinking is that you may as well let devs opt into that behavior (bear in mind that sometimes you're in the position of developing a new app against an existing db, that may or may not have another legacy app reading/writing from it at the same time). 0: https://stackoverflow.com/questions/203493/why-does-oracle-9i-treat-an-empty-string-as-null/203536#203536 https://stackoverflow.com/questions/203493/why-does-oracle-9...
- lowercased 8y ago> I assume you meant "an empty string is user supplied an empty string as data". I think so - it was a bit late. But it's the diff between intentional empty value and unknown/initial value. I still don't grok why django seems to want, by default, to ignore the concept of storing "null" in the database, and makes you jump to non-default configuration to do something which has value (seeing nulls vs empty strings means different things).