Download - Desenvolvimento web usando django
![Page 1: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/1.jpg)
DESENVOLVIMENTO WEB USANDO
DJANGO
![Page 2: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/2.jpg)
YURIMALHEIROS@
![Page 4: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/4.jpg)
TECNOLOGIA
![Page 5: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/5.jpg)
TECNOLOGIA?
![Page 6: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/6.jpg)
![Page 7: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/7.jpg)
TECNOLOGIA?
![Page 8: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/8.jpg)
![Page 9: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/9.jpg)
![Page 10: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/10.jpg)
![Page 11: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/11.jpg)
![Page 12: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/12.jpg)
![Page 13: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/13.jpg)
![Page 14: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/14.jpg)
”“SIMPLE IS
BETTER THAN
COMPLEX
![Page 15: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/15.jpg)
FRAMEWORKS
![Page 16: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/16.jpg)
”
“SE VI MAISLONGE FOI POR ESTAR SOBREOS OMBROS
DE GIGANTES
![Page 17: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/17.jpg)
![Page 18: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/18.jpg)
UM POUCO DE
HISTÓRIA...
![Page 19: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/19.jpg)
MODEL
VIEW
CONTROLLER
![Page 20: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/20.jpg)
MODEL
TEMPLATE
CONTROLLER
![Page 21: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/21.jpg)
MODEL
TEMPLATE
VIEW
![Page 22: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/22.jpg)
CODIFICANDO
![Page 23: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/23.jpg)
django-admin startproject mymusic
![Page 24: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/24.jpg)
mymusic
manage.py
settings.py
urls.py
![Page 25: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/25.jpg)
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'db.sqlite',
'USER': '‘, 'PASSWORD': '‘, 'HOST': '‘, 'PORT': '‘, }
}
settings.py
![Page 26: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/26.jpg)
manage.py startapp collection
![Page 27: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/27.jpg)
collection
models.py
tests.py
views.py
![Page 28: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/28.jpg)
from django.db import models
class Album(models.Model): artist = models.CharField(max_length=200) name = models.CharField(max_length=200) year = models.IntegerField() cover = models.URLField(verify_exists=False, blank=True)
def __unicode__(self): return "%s by %s" % (self.name, self.artist)
collection/models.py
![Page 29: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/29.jpg)
from django.db import models
class Album(models.Model): artist = models.CharField(max_length=200) name = models.CharField(max_length=200) year = models.IntegerField() cover = models.URLField(verify_exists=False, blank=True)
def __unicode__(self): return "%s by %s" % (self.name, self.artist)
collection/models.py
![Page 30: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/30.jpg)
from django.db import models
class Album(models.Model): artist = models.CharField(max_length=200) name = models.CharField(max_length=200) year = models.IntegerField() cover = models.URLField(verify_exists=False, blank=True)
def __unicode__(self): return "%s by %s" % (self.name, self.artist)
collection/models.py
![Page 31: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/31.jpg)
from django.db import models
class Album(models.Model): artist = models.CharField(max_length=200) name = models.CharField(max_length=200) year = models.IntegerField() cover = models.URLField(verify_exists=False, blank=True)
def __unicode__(self): return "%s by %s" % (self.name, self.artist)
collection/models.py
![Page 32: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/32.jpg)
from django.db import models
class Album(models.Model): artist = models.CharField(max_length=200) name = models.CharField(max_length=200) year = models.IntegerField() cover = models.URLField(verify_exists=False, blank=True)
def __unicode__(self): return "%s by %s" % (self.name, self.artist)
collection/models.py
![Page 33: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/33.jpg)
from django.db import models
class Album(models.Model): artist = models.CharField(max_length=200) name = models.CharField(max_length=200) year = models.IntegerField() cover = models.URLField(verify_exists=False, blank=True)
def __unicode__(self): return "%s by %s" % (self.name, self.artist)
collection/models.py
![Page 34: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/34.jpg)
from django.db import models
class Album(models.Model): artist = models.CharField(max_length=200) name = models.CharField(max_length=200) year = models.IntegerField() cover = models.URLField(verify_exists=False, blank=True)
def __unicode__(self): return "%s by %s" % (self.name, self.artist)
collection/models.py
![Page 35: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/35.jpg)
INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'collection',)
settings.py
![Page 36: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/36.jpg)
manage.py syncdb
![Page 37: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/37.jpg)
add/
![Page 38: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/38.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('', url(r'^add/$', collection_views.add),
)
urls.py
![Page 39: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/39.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('', url(r'^add/$', collection_views.add),
)
urls.py
![Page 40: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/40.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('', url(r'^add/$', collection_views.add),
)
urls.py
![Page 41: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/41.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('', url(r'^add/$', collection_views.add),
)
urls.py
![Page 42: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/42.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('', url(r'^add/$', collection_views.add),
)
urls.py
![Page 43: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/43.jpg)
from django.forms import ModelFormfrom collection.models import Album
class AlbumForm(ModelForm): class Meta: model = Album
exclude = (‘cover’,)
collection/forms.py
![Page 44: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/44.jpg)
from django.forms import ModelFormfrom collection.models import Album
class AlbumForm(ModelForm): class Meta: model = Album
exclude = (‘cover’,)
collection/forms.py
![Page 45: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/45.jpg)
from django.forms import ModelFormfrom collection.models import Album
class AlbumForm(ModelForm): class Meta: model = Album
exclude = (‘cover’,)
collection/forms.py
![Page 46: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/46.jpg)
from django.forms import ModelFormfrom collection.models import Album
class AlbumForm(ModelForm): class Meta: model = Album
exclude = (‘cover’,)
collection/forms.py
![Page 47: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/47.jpg)
def add(request): if request.method == 'POST': form = AlbumForm(data=request.POST)
if form.is_valid(): album = Album() album.name = form.cleaned_data['name'] album.artist = form.cleaned_data['artist'] album.year = form.cleaned_data['year'] album.cover = get_cover_url(album.artist, album.name) album.save()
collection/views.py
![Page 48: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/48.jpg)
def add(request): if request.method == 'POST': form = AlbumForm(data=request.POST)
if form.is_valid(): album = Album() album.name = form.cleaned_data['name'] album.artist = form.cleaned_data['artist'] album.year = form.cleaned_data['year'] album.cover = get_cover_url(album.artist, album.name) album.save()
collection/views.py
![Page 49: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/49.jpg)
def add(request): if request.method == 'POST': form = AlbumForm(data=request.POST)
if form.is_valid(): album = Album() album.name = form.cleaned_data['name'] album.artist = form.cleaned_data['artist'] album.year = form.cleaned_data['year'] album.cover = get_cover_url(album.artist, album.name) album.save()
collection/views.py
![Page 50: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/50.jpg)
def add(request): if request.method == 'POST': form = AlbumForm(data=request.POST)
if form.is_valid(): album = Album() album.name = form.cleaned_data['name'] album.artist = form.cleaned_data['artist'] album.year = form.cleaned_data['year'] album.cover = get_cover_url(album.artist, album.name) album.save()
collection/views.py
![Page 51: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/51.jpg)
def add(request): if request.method == 'POST': form = AlbumForm(data=request.POST)
if form.is_valid(): album = Album() album.name = form.cleaned_data['name'] album.artist = form.cleaned_data['artist'] album.year = form.cleaned_data['year'] album.cover = get_cover_url(album.artist, album.name) album.save()
collection/views.py
![Page 52: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/52.jpg)
def add(request): if request.method == 'POST': form = AlbumForm(data=request.POST)
if form.is_valid(): album = Album() album.name = form.cleaned_data['name'] album.artist = form.cleaned_data['artist'] album.year = form.cleaned_data['year'] album.cover = get_cover_url(album.artist, album.name) album.save()
collection/views.py
![Page 53: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/53.jpg)
def add(request): if request.method == 'POST': form = AlbumForm(data=request.POST)
if form.is_valid(): album = Album() album.name = form.cleaned_data['name'] album.artist = form.cleaned_data['artist'] album.year = form.cleaned_data['year'] album.cover = get_cover_url(album.artist, album.name) album.save()
collection/views.py
![Page 54: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/54.jpg)
else: form = AlbumForm()
return render_to_response('add.html', {'form' : form}, context_instance=RequestContext(request))
collection/views.py
![Page 55: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/55.jpg)
else: form = AlbumForm()
return render_to_response('add.html', {'form' : form}, context_instance=RequestContext(request))
collection/views.py
![Page 56: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/56.jpg)
else: form = AlbumForm()
return render_to_response('add.html', {'form' : form}, context_instance=RequestContext(request))
collection/views.py
![Page 57: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/57.jpg)
else: form = AlbumForm()
return render_to_response('add.html', {'form' : form}, context_instance=RequestContext(request))
collection/views.py
![Page 58: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/58.jpg)
else: form = AlbumForm()
return render_to_response('add.html', {'form' : form}, context_instance=RequestContext(request))
collection/views.py
![Page 59: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/59.jpg)
settings.py
import os
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
TEMPLATE_DIRS = (os.path.join(PROJECT_PATH, 'templates'),
)
![Page 60: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/60.jpg)
<form action="." method="post" enctype="multipart/form-data"> {% csrf_token %} {% for field in form %} <div class="fieldWrapper"> {{ field.errors }} {{ field.label_tag }}: {{ field }} </div> {% endfor %}
<p><button type="submit">Adicionar</button></p></form>
templates/add.html
![Page 61: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/61.jpg)
<form action="." method="post" enctype="multipart/form-data"> {% csrf_token %} {% for field in form %} <div class="fieldWrapper"> {{ field.errors }} {{ field.label_tag }}: {{ field }} </div> {% endfor %}
<p><button type="submit">Adicionar</button></p></form>
templates/add.html
![Page 62: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/62.jpg)
<form action="." method="post" enctype="multipart/form-data"> {% csrf_token %} {% for field in form %} <div class="fieldWrapper"> {{ field.errors }} {{ field.label_tag }}: {{ field }} </div> {% endfor %}
<p><button type="submit">Adicionar</button></p></form>
templates/add.html
![Page 63: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/63.jpg)
<form action="." method="post" enctype="multipart/form-data"> {% csrf_token %} {% for field in form %} <div class="fieldWrapper"> {{ field.errors }} {{ field.label_tag }}: {{ field }} </div> {% endfor %}
<p><button type="submit">Adicionar</button></p></form>
templates/add.html
![Page 64: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/64.jpg)
<form action="." method="post" enctype="multipart/form-data"> {% csrf_token %} {% for field in form %} <div class="fieldWrapper"> {{ field.errors }} {{ field.label_tag }}: {{ field }} </div> {% endfor %}
<p><button type="submit">Adicionar</button></p></form>
templates/add.html
![Page 65: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/65.jpg)
<form action="." method="post" enctype="multipart/form-data"> {% csrf_token %} {% for field in form %} <div class="fieldWrapper"> {{ field.errors }} {{ field.label_tag }}: {{ field }} </div> {% endfor %}
<p><button type="submit">Adicionar</button></p></form>
templates/add.html
![Page 66: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/66.jpg)
<form action="." method="post" enctype="multipart/form-data"> {% csrf_token %} {% for field in form %} <div class="fieldWrapper"> {{ field.errors }} {{ field.label_tag }}: {{ field }} </div> {% endfor %}
<p><button type="submit">Adicionar</button></p></form>
templates/add.html
![Page 67: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/67.jpg)
<form action="." method="post" enctype="multipart/form-data"> {% csrf_token %} {% for field in form %} <div class="fieldWrapper"> {{ field.errors }} {{ field.label_tag }}: {{ field }} </div> {% endfor %}
<p><button type="submit">Adicionar</button></p></form>
templates/add.html
![Page 68: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/68.jpg)
manage.py runserver
![Page 69: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/69.jpg)
![Page 70: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/70.jpg)
/
![Page 71: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/71.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('',url(r'^$', collection_views.index, name='album_index'),url(r'^add/$', collection_views.add),
)
urls.py
![Page 72: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/72.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('',url(r'^$', collection_views.index, name='album_index'),url(r'^add/$', collection_views.add),
)
urls.py
![Page 73: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/73.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('',url(r'^$', collection_views.index, name='album_index'),url(r'^add/$', collection_views.add),
)
urls.py
![Page 74: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/74.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('',url(r'^$', collection_views.index, name='album_index'),url(r'^add/$', collection_views.add),
)
urls.py
![Page 75: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/75.jpg)
def index(request): albums = Album.objects.all().order_by('name')
return render_to_response('index.html', {'albums' : albums}, context_instance=RequestContext(request))
collection/views.py
![Page 76: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/76.jpg)
def index(request): albums = Album.objects.all().order_by('name')
return render_to_response('index.html', {'albums' : albums}, context_instance=RequestContext(request))
collection/views.py
![Page 77: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/77.jpg)
def index(request): albums = Album.objects.all().order_by('name')
return render_to_response('index.html', {'albums' : albums}, context_instance=RequestContext(request))
collection/views.py
![Page 78: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/78.jpg)
def index(request): albums = Album.objects.all().order_by('name')
return render_to_response('index.html', {'albums' : albums}, context_instance=RequestContext(request))
collection/views.py
![Page 79: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/79.jpg)
def index(request): albums = Album.objects.all().order_by('name')
return render_to_response('index.html', {'albums' : albums}, context_instance=RequestContext(request))
collection/views.py
![Page 80: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/80.jpg)
def index(request): albums = Album.objects.all().order_by('name')
return render_to_response('index.html', {'albums' : albums}, context_instance=RequestContext(request))
collection/views.py
![Page 81: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/81.jpg)
def index(request): albums = Album.objects.all().order_by('name')
return render_to_response('index.html', {'albums' : albums}, context_instance=RequestContext(request))
collection/views.py
![Page 82: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/82.jpg)
{% for album in albums %}<p> {% if album.cover %} <img src="{{album.cover}}" /> {% endif %}
{{album.name}}<br /> {{album.artist}}<br /></p>{% endfor %}
templates/index.html
![Page 83: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/83.jpg)
{% for album in albums %}<p> {% if album.cover %} <img src="{{album.cover}}" /> {% endif %}
{{album.name}}<br /> {{album.artist}}<br /></p>{% endfor %}
templates/index.html
![Page 84: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/84.jpg)
{% for album in albums %}<p> {% if album.cover %} <img src="{{album.cover}}" /> {% endif %}
{{album.name}}<br /> {{album.artist}}<br /></p>{% endfor %}
templates/index.html
![Page 85: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/85.jpg)
{% for album in albums %}<p> {% if album.cover %} <img src="{{album.cover}}" /> {% endif %}
{{album.name}}<br /> {{album.artist}}<br /></p>{% endfor %}
templates/index.html
![Page 86: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/86.jpg)
{% for album in albums %}<p> {% if album.cover %} <img src="{{album.cover}}" /> {% endif %}
{{album.name}}<br /> {{album.artist}}<br /></p>{% endfor %}
templates/index.html
![Page 87: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/87.jpg)
{% for album in albums %}<p> {% if album.cover %} <img src="{{album.cover}}" /> {% endif %}
{{album.name}}<br /> {{album.artist}}<br /></p>{% endfor %}
templates/index.html
![Page 88: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/88.jpg)
![Page 89: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/89.jpg)
delete/
![Page 90: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/90.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('',url(r'^$', collection_views.index, name='album_index'),url(r'^add/$', collection_views.add),url(r'^delete/(?P<album_id>\d+)/$', collection_views.delete, name='album_delete'),
)
urls.py
![Page 91: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/91.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('',url(r'^$', collection_views.index, name='album_index'),url(r'^add/$', collection_views.add),url(r'^delete/(?P<album_id>\d+)/$', collection_views.delete, name='album_delete'),
)
urls.py
![Page 92: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/92.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('',url(r'^$', collection_views.index, name='album_index'),url(r'^add/$', collection_views.add),url(r'^delete/(?P<album_id>\d+)/$', collection_views.delete, name='album_delete'),
)
urls.py
![Page 93: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/93.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('',url(r'^$', collection_views.index, name='album_index'),url(r'^add/$', collection_views.add),url(r'^delete/(?P<album_id>\d+)/$', collection_views.delete, name='album_delete'),
)
urls.py
![Page 94: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/94.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('',url(r'^$', collection_views.index, name='album_index'),url(r'^add/$', collection_views.add),url(r'^delete/(?P<album_id>\d+)/$', collection_views.delete, name='album_delete'),
)
urls.py
![Page 95: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/95.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('',url(r'^$', collection_views.index, name='album_index'),url(r'^add/$', collection_views.add),url(r'^delete/(?P<album_id>\d+)/$', collection_views.delete, name='album_delete'),
)
urls.py
![Page 96: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/96.jpg)
from django.conf.urls.defaults import *from collection import views as collection_views
urlpatterns = patterns('',url(r'^$', collection_views.index, name='album_index'),url(r'^add/$', collection_views.add),url(r'^delete/(?P<album_id>\d+)/$', collection_views.delete, name='album_delete'),
)
urls.py
![Page 97: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/97.jpg)
def delete(request, album_id): album = Album.objects.get(pk=album_id) album.delete() return redirect('album_index')
collection/views.py
![Page 98: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/98.jpg)
def delete(request, album_id): album = Album.objects.get(pk=album_id) album.delete() return redirect('album_index')
collection/views.py
![Page 99: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/99.jpg)
def delete(request, album_id): album = Album.objects.get(pk=album_id) album.delete() return redirect('album_index')
collection/views.py
![Page 100: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/100.jpg)
def delete(request, album_id): album = Album.objects.get(pk=album_id) album.delete() return redirect('album_index')
collection/views.py
![Page 101: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/101.jpg)
{% for album in albums %}<p> {% if album.cover %} <img src="{{album.cover}}" /> {% endif %}
{{album.name}}<br /> {{album.artist}}<br /> <a href={% url album_delete album.pk %}>apagar</a></p>{% endfor %}
templates/index.html
![Page 102: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/102.jpg)
![Page 103: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/103.jpg)
![Page 104: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/104.jpg)
GITHUB.COM/YURIMALHEIR
OS
![Page 105: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/105.jpg)
BÁSICO
![Page 106: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/106.jpg)
PYTHON
![Page 107: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/107.jpg)
FERRAMENTA
![Page 108: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/108.jpg)
COMUNIDADE
![Page 109: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/109.jpg)
BOA ESCOLHA :)
![Page 110: Desenvolvimento web usando django](https://reader034.vdocuments.us/reader034/viewer/2022051400/54c5d61b4a7959e2408b4609/html5/thumbnails/110.jpg)
DÚVIDAS?