Your SlideShare is downloading. ×
0
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Django 101
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Django 101

2,865

Published on

Alguns conceitos e dicas que você queria saber e o seu tutorial copy-paste não te falou!

Alguns conceitos e dicas que você queria saber e o seu tutorial copy-paste não te falou!

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,865
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. django 101 Todas os conceitos e dicas que você queria saber e o seu tutorial copy-paste não te falou!Sunday, December 16, 12
  • 2. Filipe A. Ximenes filipeximenes@gmail.com traineeworld.com.br/cv/ximenes filipeaximenes filipeximenesSunday, December 16, 12
  • 3. Real World Django TalksSunday, December 16, 12
  • 4. Renato Oliveira Filipe XimenesSunday, December 16, 12
  • 5. django in a nutshell • Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. • The Web framework for perfectionists with deadlines.Sunday, December 16, 12
  • 6. MVCSunday, December 16, 12
  • 7. Arquitetura MVC • Model • View • ControllerSunday, December 16, 12
  • 8. Model • modelagem dos dados • persistência • responsável pela manutenção dos dados • diretamente relacionado com o banco de dadosSunday, December 16, 12
  • 9. Controller • centro de controle. • prepara os dados para serem dispostosSunday, December 16, 12
  • 10. View • como os dados são dispostos • HTMLSunday, December 16, 12
  • 11. View • A view requests from the model the information that it needs to generate an output representation. (fonte: wikipedia)Sunday, December 16, 12
  • 12. View • the “view” describes the data that gets presented to the user. It’s not necessarily how the data looks, but which data is presented. The view describes which data you see, not how you see it. It’s a subtle distinction. (fonte: djangoproject.org)Sunday, December 16, 12
  • 13. MVCSunday, December 16, 12
  • 14. MTVSunday, December 16, 12
  • 15. Arquitetura MTV • Model • View • TemplateSunday, December 16, 12
  • 16. Model • modelagem dos dados • persistência • responsável pela manutenção dos dados • diretamente relacionado com o banco de dadosSunday, December 16, 12
  • 17. View • centro de controle. • prepara os dados para serem dispostosSunday, December 16, 12
  • 18. Template • como os dados são dispostos • HTMLSunday, December 16, 12
  • 19. Project vs. AppsSunday, December 16, 12
  • 20. Apps • micro instâncias da arquitetura MTV • separar funcionalidades o máximo possível • crie apps genéricos e distribua!Sunday, December 16, 12
  • 21. Project • coleção de appsSunday, December 16, 12
  • 22. Herança de TemplateSunday, December 16, 12
  • 23. • defina base.html • defina blocos • extenda base.html e sobrescreva os blocosSunday, December 16, 12
  • 24. Exemplo <html> <head> <title>{% block titulo %}p1{% endblock %} - Exemplo</title> </head> <body> <h1>{% block texto %}Hello World{% endblock %}</h1> </body> </html>Sunday, December 16, 12
  • 25. pagina 2 {% extends “base.html” %} {% block titulo %}p2{% endblock %} {% block texto %}texto da p2{% endblock %}Sunday, December 16, 12
  • 26. Generic Views • django.views.generic.simple.direct_to_template • (r^minha_url/$, direct_to_template, {template: meu_template.html}), • django.views.generic.simple.redirect_to • (^foo/(?P<id>d+)/$, redirect_to, {url: /bar/%(id)s/}),Sunday, December 16, 12
  • 27. Shortcuts • render_to_response • redirect • get_object_or_404Sunday, December 16, 12
  • 28. URL ReverseSunday, December 16, 12
  • 29. Em urls.py: from mysite import views urlpatterns = patterns(, (r^sobre/$, views.about, name=”about”), )Sunday, December 16, 12
  • 30. No seu html: . . . <a href=”{% url about %}”>Sobre</a> . . .Sunday, December 16, 12
  • 31. No seu .py: from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect def about(request): return HttpResponseRedirect(reverse(‘about’))Sunday, December 16, 12
  • 32. Migrações • O que é? • South • http://south.aeracode.org/Sunday, December 16, 12
  • 33. TestesSunday, December 16, 12
  • 34. Dúvidas? filipeximenes@gmail.com traineeworld.com.br/cv/ximenes filipeaximenes filipeximenesSunday, December 16, 12

×