Skip to content

Commit

Permalink
remove dont used templates, templatetags, optimize imports, enable ru…
Browse files Browse the repository at this point in the history
…ssian locale
  • Loading branch information
d1ffuz0r committed Oct 30, 2011
1 parent 1ac1a77 commit 748abcc
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 50 deletions.
16 changes: 8 additions & 8 deletions ajax/tests.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from bugurtach.models import Bugurt, Comments
from django.contrib.auth.models import User
from django.test.client import Client
from django.test import TestCase
from datetime import datetime
from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User
from bugurtach.models import Bugurt, Comments

class TestAjaxForms(TestCase):

Expand Down Expand Up @@ -80,9 +80,9 @@ def test_delete_tag(self):
self.client.post("/login/", {"username": "root1", "password": "root"})
self.client.post("/ajax/add_tag/",{"bugurt": 1, "tag": "tag1"},
**{'HTTP_X_REQUESTED_WITH':'XMLHttpRequest'})
print self.client.post("/ajax/delete_tag/", {"bugurt": 1, "tag": "tag1"},
**{'HTTP_X_REQUESTED_WITH':'XMLHttpRequest'})
#self.assertEqual(request, "null")
request = self.client.post("/ajax/delete_tag/",{"bugurt": 1, "tag": "tag1"},
**{'HTTP_X_REQUESTED_WITH':'XMLHttpRequest'})
self.assertContains(request, text="null")

def test_add_proof(self):
self.client.post("/login/", {"username": "root1", "password": "root"})
Expand All @@ -108,7 +108,7 @@ def test_delete_proof(self):
**{'HTTP_X_REQUESTED_WITH':'XMLHttpRequest'})
request = self.client.post("/ajax/delete_proof/",{"bugurt": 1, "proof": "proof1"},
**{'HTTP_X_REQUESTED_WITH':'XMLHttpRequest'})
self.assertEqual(request.content, "null")
self.assertContains(request, text="null")

def test_autocomplite(self):
self.client.post("/login/", {"username": "root1", "password": "root"})
Expand Down
4 changes: 2 additions & 2 deletions ajax/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from bugurtach.models import Bugurt, Comments, BugurtTags, Tag, Proof, BugurtProofs
from decorators import render_json, check_ajax
from django.http import HttpResponse
from django.utils.html import escape
from decorators import render_json, check_ajax
from bugurtach.models import Bugurt, Comments, BugurtTags, Tag, Proof, BugurtProofs

def reply(request):
random_reply = Comments.objects.order_by('?')[0].text
Expand Down
2 changes: 1 addition & 1 deletion bugurtach/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin
from django.contrib.auth.models import Group
from bugurtach.models import *
from bugurtach.models import Bugurt, CustomUser, Like, Tag, Proof, BugurtTags, BugurtProofs, Comments

class CustomUserAdmin(admin.ModelAdmin):
list_display = ("user", )
Expand Down
2 changes: 0 additions & 2 deletions bugurtach/templatetags/__init__.py

This file was deleted.

9 changes: 0 additions & 9 deletions bugurtach/templatetags/comment_tags.py

This file was deleted.

5 changes: 2 additions & 3 deletions bugurtach/tests.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
from django.core.exceptions import ValidationError
from django.test import TestCase
from bugurtach.models import Tag, Proof, CustomUser, Bugurt, BugurtTags, Like, Comments, BugurtProofs
from django.contrib.auth.models import User
from django.test.client import Client
from django.contrib.auth.models import User
from bugurtach.models import Tag, Proof, CustomUser, Bugurt, BugurtTags, Like, Comments, BugurtProofs
from ajax.tests import TestAjaxForms

class TestModels(TestCase):
Expand Down
4 changes: 2 additions & 2 deletions bugurtach/views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
from bugurtach.models import Tag, Comments, Bugurt
from django.contrib.auth.forms import UserCreationForm, PasswordChangeForm
from bugurtach.forms import EditBugurt, AddTag, AddProof, AddBugurt
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate, login
from django.http import HttpResponseRedirect, Http404
from bugurtach.models import Tag, Comments, Bugurt
from bugurtach.forms import EditBugurt, AddTag, AddProof, AddBugurt
from decorators import render_to


Expand Down
2 changes: 1 addition & 1 deletion decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
#from django.views.decorators.cache import cache_control
from django.utils.simplejson import dumps
#from django.views.decorators.cache import cache_control

def render_to(template):
"""
Expand Down
18 changes: 17 additions & 1 deletion public/templates/bugurts/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ <h3>{{ bugurt.name }} :: {{ bugurt.date|date:'' }} {% ifequal bugurt.author.id u
<a href="{{ tag.get_absolute_url }}">{{ tag.title }}</a>
{% endfor %}</div>
</div>{% endif %}
</div>{% include 'includes/commentaries.html' %}{% else %}Not bugurts
</div>
<div id="commentaries">
<h3>Комментарии:</h3>
<ul id="comments">
{% if bugurt.bugurtcomments %}{% for comment in bugurt.bugurtcomments.all %}<li id="comment{{ comment.id }}" class="reply">
<div>#{{ comment.id }} {{ comment.author }} {{ comment.date|date:"d.m.y, H:m" }}</div>{{ comment.text }}
</li>{% endfor %}
{% else %}Комметариев нет{% endif %}</ul>
{% if user.is_authenticated %}
<form action="/ajax/post_comment/" method="post">
{% csrf_token %}
<input type="hidden" id="bugurt" value="{{ bugurt.id }}">
<p><label for="text">Комментарий</label><br /><textarea id="text" rows="10" cols="60"></textarea></p>
</form>
<button id="add_post">Ответить</button>
{% endif %}</div>
{% else %}Not bugurt
{% endif %}
{% endblock %}
8 changes: 0 additions & 8 deletions public/templates/comments/form.html

This file was deleted.

8 changes: 0 additions & 8 deletions public/templates/includes/commentaries.html

This file was deleted.

4 changes: 2 additions & 2 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = False
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = False
USE_L10N = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
Expand Down
6 changes: 3 additions & 3 deletions urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from django.conf.urls.defaults import patterns, include, url
from ajax.views import like, add_comment, add_tag, delete_tag, add_proof, delete_proof, reply, autocomplite
from bugurtach.views import homepage, user_settings, registration, add_bugurt, edit_bugurt, view_bugurt, all_bugurts, \
delete_bugurt, view_user, view_tags, view_all_tags, top_bugurts
from django.contrib import admin
from django.contrib.auth.views import login, logout
from ajax.views import like, add_comment, add_tag, delete_tag, add_proof, delete_proof, reply, autocomplite
from bugurtach.views import homepage, user_settings, registration, add_bugurt, edit_bugurt, view_bugurt, all_bugurts,\
delete_bugurt, view_user, view_tags, view_all_tags, top_bugurts

import settings

Expand Down

0 comments on commit 748abcc

Please sign in to comment.