Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cosa mi entusiasma nelle prossime release di Django

Cosa mi entusiasma nelle prossime release di Django

Alcune piccole feature inserite nelle prossime release di Django e una piccola guida su come iniziare a proporne di proprie.

61ba6f6b1fb82707b9344259f74a81b3?s=128

Riccardo Magliocchetti

April 17, 2015
Tweet

More Decks by Riccardo Magliocchetti

Other Decks in Programming

Transcript

  1. Cosa mi entusiasma nelle prossime release di Django Riccardo Magliocchetti

    DjangoVillage 2015
  2. whoami Free software developer • Maintainer: django-admin-bootstrapped, bootchart2, ... •

    contributore: uwsgi, LibreOffice, ...
  3. In Django 1.8

  4. Poor man's multi tenancy Fixed #15089 -- Allowed contrib.sites to

    lookup the current site based on request.get_host() get_current_site() will now lookup the current site based on request.get_host() if the SITE_ID setting is not defined. https://github.com/django/django/commit/32c7d3c061b83e9206 ef2bf13fbc302a1998f317
  5. Poor man's multi tenancy: threadlocals from threading import local _tlocals

    = local() class ThreadLocalMiddleware(object): def process_request(self, request): _tlocals.request = request def get_tls_request(): return getattr(_tlocals, "request")
  6. Poor man's multi tenancy: settings.py SITE_ID = None MIDDLEWARE_CLASSES +=

    ( 'threadlocals.ThreadLocalMiddleware' )
  7. Poor man's multi tenancy: your code from django.contrib.sites.shortcuts import get_current_site

    from threadlocals import get_tls_request request = get_tls_request() site = get_current_site(request)
  8. Poor man's multi tenancy: profit! Collegate le vostre configurazioni a

    django.contrib.sites.models.Site
  9. In Django 1.9

  10. Stop alle window in admin! (DIY) Fixed #22894 -- Made

    admin add related/raw ID fields widgets customizable Fixed #24405 -- Made admin related object JavaScript overridable
  11. Lista applicazioni nell'admin Fixed #24553 -- Added the list of

    applications to the context of admin views
  12. None
  13. Rework loading template Fixed #15053 -- Make templates more reusable

    by Improving template loading algorithm to avoid extending infinite recursion Thanks to Preston Timmons
  14. Temi facili templates/admin/base.html: {% extends "admin/base.html" %} {% block title

    %} Cambio solo il title {% endblock %}
  15. Contribuire a Django è possibile!

  16. Indovina chi?

  17. E` Tim! Tim Graham - Django Fellow Donate! https://www.djangoproject.com/fundraising/

  18. Django Fellowship program [...] • reviewing and merging pull requests

    • triaging tickets on Trac • helping new Django contributors land patches and learn our philosophy
  19. Quindi? C'è qualcuno pagato per aiutarvi a contribuire

  20. Come si contribuisce a Django?

  21. Aprire un Ticket https://code.djangoproject.com Cerchiamo tra i ticket già inseriti

    duplicati :) Cosa vogliamo fare e perchè NON scrivo una riga di codice
  22. Primo feedback Utile? Duplicato? Richiede discussione in lista django-developers? Riguarda

    la ux? UI/UX
  23. Ticket accettato Triage stage: Unreviewed -> Accepted

  24. Preparo l'environment Fork su github git clone <url repo fork>

    cd django git remote add upstream https://github.com/django/django.git git checkout ­b ticketNumero virtualenv masterenv ./masterenv/bin/pip install ~/path/repo/django
  25. Codice in github Commit, commit, commit, push! Pull request!

  26. Review Ci sono cose da sistemare? patch needs improvement Manca

    doc? needs documentation Mancano i test? needs tests
  27. Reitera git push ­f vostrorepo vostrobranch Fatte le modifiche: tolgo

    patch needs improvement
  28. Evitare il ping-pong isort filecambiato.py ­­diff flake8 filecambiato.py cd docs;

    make html cd tests; PYTHONPATH=.. python runtests.py
  29. Test tricks # se ho cambiato a html / js

    # installate ultima versione selenium runtests.py ­­selenium # Trova da quando miotest viene spaccato runtests.py ­­bisect miotest # Trova un test che spacca miotest runtests.py ­­pair miotest
  30. Test like a pro djangocore-box: tutte le versioni di python,

    tutti i db in vm https://github.com/jphalip/djangocore-box djangocore-docker: pgsql + python in un container https://github.com/PirosB3/djangocore-docker
  31. Reference https://docs.djangoproject.com/en/1.8/internals /contributing/writing-code/submitting-patches/

  32. Happy Hacking Riccardo Magliocchetti riccardo@menodizero.it @rmistaken http://menodizero.it https://github.com/xrmx