-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from lluminita/add-update-and-detail-views
add update and details features
- Loading branch information
Showing
5 changed files
with
73 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{% extends "codeeve/index.html" %} | ||
|
||
{% block header %} | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div class="content-section-a"> | ||
|
||
<div class="container"> | ||
<div class="row"> | ||
<a href="/projects/">Go to list all projects</a> | ||
<a href="update/">Update the project</a> | ||
<div class="col-lg-5 col-sm-6"> | ||
<hr class="section-heading-spacer"> | ||
<div class="clearfix"></div> | ||
<h2 class="section-heading">{{ project.title }}</h2> | ||
<p>{{ project.created_at|date:"D d M Y" }}</p> | ||
<div class="glossy-{{ project.difficulty }}"> | ||
<p> {{ project.difficulty }}</p> | ||
</div> | ||
<p>{{ project.description}}</p> | ||
{% if project.max_members > project.participants.count %} | ||
<button type="button"> Join!</button> | ||
{% endif %} | ||
</div> | ||
|
||
<div class="col-lg-5 col-lg-offset-2 col-sm-6"> | ||
<hr class="section-heading-spacer"> | ||
<div class="clearfix"></div> | ||
{% if project.image %} | ||
<img src = "{{project.image.url}}"> | ||
{% endif %} | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
</div> | ||
|
||
<div> | ||
</div> | ||
|
||
{% endblock %} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
from django.conf.urls import url | ||
from projects.views import ProjectListView, ProjectCreate | ||
from projects.views import (ProjectListView, ProjectCreate, ProjectDetailView, | ||
ProjectUpdate) | ||
|
||
|
||
urlpatterns = [ | ||
|
||
url(r'^$', ProjectListView.as_view(), name='project_list'), | ||
url(r'^create/$', ProjectCreate.as_view(), name='project_create'), | ||
url(r'^$', | ||
ProjectListView.as_view(), | ||
name='project_list'), | ||
url(r'^details/(?P<pk>\d+)/$', | ||
ProjectDetailView.as_view(), | ||
name='project_details'), | ||
url(r'^create/$', | ||
ProjectCreate.as_view(), | ||
name='project_create'), | ||
url(r'^details/(?P<pk>\d+)/update/$', | ||
ProjectUpdate.as_view(), | ||
name='project_update'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
from django.views.generic.list import ListView | ||
from django.views.generic.edit import CreateView, UpdateView, DeleteView | ||
from django.views.generic.detail import DetailView | ||
from django.views.generic.edit import CreateView, UpdateView | ||
from django.core.urlresolvers import reverse_lazy | ||
from .models import Project | ||
|
||
|
||
class ProjectCreate(CreateView): | ||
template_name = 'projects/create_project.html' | ||
model = Project | ||
fields = '__all__' | ||
fields = ['title', 'description', 'max_members', 'difficulty', | ||
'image', 'participants', 'coach', 'owner'] | ||
success_url = reverse_lazy('project_list') | ||
|
||
|
||
class ProjectUpdate(UpdateView): | ||
model = Project | ||
fields = '__all__' | ||
success_url = reverse_lazy('project_list') | ||
fields = ['title', 'description', 'max_members', 'difficulty', | ||
'image', 'participants', 'coach'] | ||
success_url = reverse_lazy('project_details') | ||
|
||
|
||
class ProjectDelete(DeleteView): | ||
class ProjectListView(ListView): | ||
model = Project | ||
success_url = reverse_lazy('project_list') | ||
|
||
|
||
class ProjectListView(ListView): | ||
class ProjectDetailView(DetailView): | ||
model = Project |