Remove projects, is being handled by html_pages now

This commit is contained in:
Tom Willemsen 2011-11-05 13:55:14 +01:00
parent 39f711d813
commit 1766db73d9
8 changed files with 1 additions and 105 deletions

View file

View file

@ -1,6 +0,0 @@
from projects.models import Project, Language, Screenshot
from django.contrib import admin
admin.site.register(Project)
admin.site.register(Language)
admin.site.register(Screenshot)

View file

@ -1,59 +0,0 @@
from django.db import models
from main.models import Tag, Activity
from django.db.models.signals import post_save, post_delete
class Language(models.Model):
name = models.CharField(max_length=100)
def __unicode__(self):
return self.name
class Screenshot(models.Model):
url = models.URLField(max_length=255)
description = models.CharField(max_length=300)
def __unicode__(self):
return self.description
class Project(models.Model):
STATUS_CHOICES = (
('active', "Active"),
('onhold', "On Hold"),
('dropped', "Dropped"),
)
slug = models.SlugField(max_length=255, primary_key=True)
name = models.CharField(max_length=300)
status = models.CharField(max_length=8, choices=STATUS_CHOICES)
tagline = models.CharField(max_length=140, null=True, blank=True)
languages = models.ManyToManyField(Language, null=True, blank=True)
source_url = models.URLField(max_length=255, null=True, blank=True)
bugtracker_url = models.URLField(max_length=255, null=True, blank=True)
wiki_url = models.URLField(max_length=255, null=True, blank=True)
description = models.TextField()
screenshots = models.ForeignKey(Screenshot, null=True, blank=True)
# tags = models.ManyToManyField(Tag, null=True, blank=True)
def __unicode__(self):
return self.name
def project_saved_callback(sender, **kwargs):
if kwargs['created']:
acttype = 'add'
else:
acttype = 'edit'
a = Activity(actcategory='project',
actdescription=kwargs["instance"].name,
acttype = acttype,
objpk = kwargs["instance"].pk)
a.save()
def project_deleted_callback(sender, **kwargs):
a = Activity(actcategory='project',
actdescription=kwargs["instance"].name,
acttype = 'delete')
a.save()
post_save.connect(project_saved_callback, sender=Project)
post_delete.connect(project_deleted_callback, sender=Project)

View file

@ -1,13 +0,0 @@
from django.conf.urls.defaults import *
from projects.models import Project, Language
project_info_dict = {
'queryset': Project.objects.all(),
}
urlpatterns = patterns('',
(r'^$',
'django.views.generic.list_detail.object_list',
project_info_dict),
(r'^(?P<object_id>[\w-]+)/$', 'projects.views.project'),
)

View file

@ -1,24 +0,0 @@
from django.http import HttpResponse
from django.template import Context, loader
from projects.models import Project
def project(request, object_id):
project = Project.objects.get(pk=object_id)
stats_dict = {
"Status": project.get_status_display(),
"Languages": ", ".join([language.name for language in project.languages.all()]),
}
links_dict = {
"Source": project.source_url,
"Bugtracker": project.bugtracker_url,
"Wiki": project.wiki_url,
}
t = loader.get_template("projects/project_detail.html")
c = Context({
"object": project,
"stats": stats_dict,
"links": links_dict,
})
return HttpResponse(t.render(c))

View file

@ -86,6 +86,5 @@ INSTALLED_APPS = (
# 'django.contrib.admindocs', # 'django.contrib.admindocs',
'main', 'main',
'blog', 'blog',
'projects',
'pages', 'pages',
) )

View file

@ -24,7 +24,7 @@
</div> </div>
<a href="/">home</a><br /> <a href="/">home</a><br />
<a href="/blog/">blog</a><br /> <a href="/blog/">blog</a><br />
<a href="/projects/">projects</a><br /> <a href="/Projects/">projects</a><br />
</div> </div>
{% block submenu %}{% endblock %} {% block submenu %}{% endblock %}

View file

@ -7,7 +7,6 @@ admin.autodiscover()
urlpatterns = patterns('', urlpatterns = patterns('',
(r'^blog/', include("blog.urls")), (r'^blog/', include("blog.urls")),
(r'^projects/', include("projects.urls")),
(r'^admin/', include(admin.site.urls)), (r'^admin/', include(admin.site.urls)),
(r'^', include("main.urls")), (r'^', include("main.urls")),
) )