Removed links module
This commit is contained in:
parent
62cc00f062
commit
d7f9943510
10 changed files with 0 additions and 95 deletions
|
@ -1,4 +0,0 @@
|
||||||
from links.models import Bookmark
|
|
||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
admin.site.register(Bookmark)
|
|
|
@ -1,35 +0,0 @@
|
||||||
from django.db import models
|
|
||||||
from main.models import Tag, Activity
|
|
||||||
from django.db.models.signals import post_save, post_delete
|
|
||||||
|
|
||||||
class Bookmark(models.Model):
|
|
||||||
url = models.URLField(primary_key=True, max_length=255)
|
|
||||||
date = models.DateTimeField(auto_now_add=True)
|
|
||||||
name = models.CharField(max_length=255)
|
|
||||||
description = models.TextField()
|
|
||||||
# tags = models.ManyToManyField(Tag, null=True, blank=True)
|
|
||||||
priority = models.IntegerField(null=True, blank=True)
|
|
||||||
|
|
||||||
def __unicode__(self):
|
|
||||||
return self.name
|
|
||||||
|
|
||||||
def bookmark_saved_callback(sender, **kwargs):
|
|
||||||
if kwargs['created']:
|
|
||||||
acttype = 'add'
|
|
||||||
else:
|
|
||||||
acttype = 'edit'
|
|
||||||
|
|
||||||
a = Activity(actcategory='link',
|
|
||||||
actdescription=kwargs["instance"].name,
|
|
||||||
acttype = acttype,
|
|
||||||
objpk = kwargs["instance"].pk)
|
|
||||||
a.save()
|
|
||||||
|
|
||||||
def bookmark_deleted_callback(sender, **kwargs):
|
|
||||||
a = Activity(actcategory='link',
|
|
||||||
actdescription=kwargs["instance"].name,
|
|
||||||
acttype = 'delete')
|
|
||||||
a.save()
|
|
||||||
|
|
||||||
post_save.connect(bookmark_saved_callback, sender=Bookmark)
|
|
||||||
post_delete.connect(bookmark_deleted_callback, sender=Bookmark)
|
|
|
@ -1,16 +0,0 @@
|
||||||
"""
|
|
||||||
This file demonstrates writing tests using the unittest module. These will pass
|
|
||||||
when you run "manage.py test".
|
|
||||||
|
|
||||||
Replace this with more appropriate tests for your application.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
|
|
||||||
class SimpleTest(TestCase):
|
|
||||||
def test_basic_addition(self):
|
|
||||||
"""
|
|
||||||
Tests that 1 + 1 always equals 2.
|
|
||||||
"""
|
|
||||||
self.assertEqual(1 + 1, 2)
|
|
|
@ -1,5 +0,0 @@
|
||||||
from django.conf.urls.defaults import patterns
|
|
||||||
|
|
||||||
urlpatterns = patterns('links.views',
|
|
||||||
(r'^$', 'index'),
|
|
||||||
)
|
|
|
@ -1,12 +0,0 @@
|
||||||
from links.models import Bookmark
|
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.template import Context, loader
|
|
||||||
|
|
||||||
def index(request):
|
|
||||||
bookmark_list = Bookmark.objects.all().order_by("-date")[:100]
|
|
||||||
t = loader.get_template("links/links.html")
|
|
||||||
c = Context({
|
|
||||||
'bookmarklist': bookmark_list,
|
|
||||||
})
|
|
||||||
|
|
||||||
return HttpResponse(t.render(c))
|
|
|
@ -87,5 +87,4 @@ INSTALLED_APPS = (
|
||||||
'main',
|
'main',
|
||||||
'blog',
|
'blog',
|
||||||
'projects',
|
'projects',
|
||||||
'links',
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
<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 />
|
||||||
<a href="/links/">links</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% block submenu %}{% endblock %}
|
{% block submenu %}{% endblock %}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
{% extends "base.html" %}
|
|
||||||
|
|
||||||
{% block subtitle %}
|
|
||||||
links
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="container">
|
|
||||||
<div class="header">
|
|
||||||
<span class="title">links</span>
|
|
||||||
</div>
|
|
||||||
{% if bookmarklist %}
|
|
||||||
{% for link in bookmarklist %}
|
|
||||||
<a href="{{ link.url }}">{{ link.name }}</a><br/>
|
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
|
||||||
No links, no where...
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
1
urls.py
1
urls.py
|
@ -8,7 +8,6 @@ admin.autodiscover()
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
(r'^blog/', include("blog.urls")),
|
(r'^blog/', include("blog.urls")),
|
||||||
(r'^projects/', include("projects.urls")),
|
(r'^projects/', include("projects.urls")),
|
||||||
(r'^links/', include("links.urls")),
|
|
||||||
(r'^admin/', include(admin.site.urls)),
|
(r'^admin/', include(admin.site.urls)),
|
||||||
(r'^', include("main.urls")),
|
(r'^', include("main.urls")),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue