From 1766db73d97fe0b4e806bfc8e9e68d7400b4c935 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sat, 5 Nov 2011 13:55:14 +0100 Subject: [PATCH] Remove projects, is being handled by html_pages now --- projects/__init__.py | 0 projects/admin.py | 6 ----- projects/models.py | 59 -------------------------------------------- projects/urls.py | 13 ---------- projects/views.py | 24 ------------------ settings.py | 1 - templates/base.html | 2 +- urls.py | 1 - 8 files changed, 1 insertion(+), 105 deletions(-) delete mode 100644 projects/__init__.py delete mode 100644 projects/admin.py delete mode 100644 projects/models.py delete mode 100644 projects/urls.py delete mode 100644 projects/views.py diff --git a/projects/__init__.py b/projects/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/projects/admin.py b/projects/admin.py deleted file mode 100644 index b5ec7d4..0000000 --- a/projects/admin.py +++ /dev/null @@ -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) diff --git a/projects/models.py b/projects/models.py deleted file mode 100644 index 4b2b49a..0000000 --- a/projects/models.py +++ /dev/null @@ -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) diff --git a/projects/urls.py b/projects/urls.py deleted file mode 100644 index 053ab5b..0000000 --- a/projects/urls.py +++ /dev/null @@ -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[\w-]+)/$', 'projects.views.project'), -) diff --git a/projects/views.py b/projects/views.py deleted file mode 100644 index ad46ebd..0000000 --- a/projects/views.py +++ /dev/null @@ -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)) diff --git a/settings.py b/settings.py index 50e4d11..f19b8e3 100644 --- a/settings.py +++ b/settings.py @@ -86,6 +86,5 @@ INSTALLED_APPS = ( # 'django.contrib.admindocs', 'main', 'blog', - 'projects', 'pages', ) diff --git a/templates/base.html b/templates/base.html index 01ec076..3c15623 100644 --- a/templates/base.html +++ b/templates/base.html @@ -24,7 +24,7 @@ home
blog
- projects
+ projects
{% block submenu %}{% endblock %} diff --git a/urls.py b/urls.py index 3b24bf7..26aa007 100644 --- a/urls.py +++ b/urls.py @@ -7,7 +7,6 @@ admin.autodiscover() urlpatterns = patterns('', (r'^blog/', include("blog.urls")), - (r'^projects/', include("projects.urls")), (r'^admin/', include(admin.site.urls)), (r'^', include("main.urls")), )