Remove unused code.
parent
0b4e7d9f20
commit
ad8263e837
|
@ -1,3 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
|
@ -1,14 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
|
|
||||||
def set_token(user):
|
|
||||||
"""
|
|
||||||
Set new token for user profile.
|
|
||||||
"""
|
|
||||||
|
|
||||||
token = unicode(uuid.uuid4())
|
|
||||||
user.token = token
|
|
||||||
user.save()
|
|
||||||
return token
|
|
|
@ -1,41 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import unicodedata
|
|
||||||
|
|
||||||
|
|
||||||
class Singleton(type):
|
|
||||||
""" Singleton metaclass. """
|
|
||||||
def __init__(cls, name, bases, dct):
|
|
||||||
cls.__instance = None
|
|
||||||
type.__init__(cls, name, bases, dct)
|
|
||||||
|
|
||||||
def __call__(cls, *args, **kw):
|
|
||||||
if cls.__instance is None:
|
|
||||||
cls.__instance = type.__call__(cls, *args, **kw)
|
|
||||||
return cls.__instance
|
|
||||||
|
|
||||||
|
|
||||||
def iter_points(queryset):
|
|
||||||
for item in queryset:
|
|
||||||
if item.points == -1:
|
|
||||||
yield 0
|
|
||||||
elif item.points == -2:
|
|
||||||
yield 0.5
|
|
||||||
else:
|
|
||||||
yield item.points
|
|
||||||
|
|
||||||
|
|
||||||
def clear_model_dict(data):
|
|
||||||
hidden_fields = ['password']
|
|
||||||
|
|
||||||
new_dict = {}
|
|
||||||
for key, val in data.items():
|
|
||||||
if not key.startswith('_') and key not in hidden_fields:
|
|
||||||
new_dict[key] = val
|
|
||||||
|
|
||||||
return new_dict
|
|
||||||
|
|
||||||
|
|
||||||
def normalize_tagname(tagname):
|
|
||||||
value = unicodedata.normalize('NFKD', tagname).encode('ascii', 'ignore')
|
|
||||||
return value.lower()
|
|
|
@ -23,7 +23,6 @@ def slugify_uniquely(value, model, slugfield="slug"):
|
||||||
suffix += 1
|
suffix += 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def ref_uniquely(p, seq_field, model, field='ref'):
|
def ref_uniquely(p, seq_field, model, field='ref'):
|
||||||
project = p.__class__.objects.select_for_update().get(pk=p.pk)
|
project = p.__class__.objects.select_for_update().get(pk=p.pk)
|
||||||
ref = getattr(project, seq_field) + 1
|
ref = getattr(project, seq_field) + 1
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
|
@ -1,33 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from django.dispatch import receiver
|
|
||||||
from django.conf import settings
|
|
||||||
from django.utils.translation import ugettext
|
|
||||||
from django.template.loader import render_to_string
|
|
||||||
|
|
||||||
from greenmine.base import signals
|
|
||||||
from greenmine.base.users.utils import set_token
|
|
||||||
from greenmine.base.mail.tasks import send_mail, send_bulk_mail
|
|
||||||
|
|
||||||
|
|
||||||
@receiver(signals.mail_new_user)
|
|
||||||
def mail_new_user(sender, user, **kwargs):
|
|
||||||
template = render_to_string("email/new.user.html", {
|
|
||||||
"user": user,
|
|
||||||
"token": set_token(user),
|
|
||||||
'current_host': settings.HOST,
|
|
||||||
})
|
|
||||||
|
|
||||||
subject = ugettext("Greenmine: wellcome!")
|
|
||||||
send_mail.delay(subject, template, [user.email])
|
|
||||||
|
|
||||||
|
|
||||||
@receiver(signals.mail_recovery_password)
|
|
||||||
def mail_recovery_password(sender, user, **kwargs):
|
|
||||||
template = render_to_string("email/forgot.password.html", {
|
|
||||||
"user": user,
|
|
||||||
"token": set_token(user),
|
|
||||||
"current_host": settings.HOST,
|
|
||||||
})
|
|
||||||
subject = ugettext("Greenmine: password recovery.")
|
|
||||||
send_mail.delay(subject, template, [user.email])
|
|
|
@ -1,3 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue