|
|
|
|
@ -5,7 +5,7 @@ import datetime |
|
|
|
|
from django.core.urlresolvers import reverse |
|
|
|
|
import calendar as python_calendar |
|
|
|
|
from django.shortcuts import get_object_or_404 |
|
|
|
|
from django.http import HttpResponseRedirect, HttpResponse, Http404 |
|
|
|
|
from django.http import HttpResponseRedirect, HttpResponse, Http404, HttpResponseBadRequest |
|
|
|
|
from django.contrib.auth.decorators import login_required |
|
|
|
|
from django.utils.translation import ugettext as _, get_language |
|
|
|
|
from django_messages.forms import SendForm |
|
|
|
|
@ -26,7 +26,7 @@ from company.edit_forms import NameForm as CompNameForm, HomeForm as CompHomeFor |
|
|
|
|
FoundationForm as CompFound, SpecializationForm as CompSpec, AddressForm as CompAddress |
|
|
|
|
from meta.views import MetadataMixin |
|
|
|
|
from emencia.django.newsletter.forms import SubscribeSettingsForm |
|
|
|
|
from emencia.django.newsletter.models import Contact |
|
|
|
|
from emencia.django.newsletter.models import Contact, ContactSettings |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SettingsView(TemplateView): |
|
|
|
|
@ -42,7 +42,13 @@ class SettingsView(TemplateView): |
|
|
|
|
try: |
|
|
|
|
contact = user.contact_set.get(email=user.username) |
|
|
|
|
except Contact.DoesNotExist: |
|
|
|
|
contact = None |
|
|
|
|
try: |
|
|
|
|
contact = Contact.objects.get(email=user.username) |
|
|
|
|
contact.user = user |
|
|
|
|
contact.save() |
|
|
|
|
except Contact.DoesNotExist: |
|
|
|
|
contact = None |
|
|
|
|
|
|
|
|
|
if not contact: |
|
|
|
|
return SubscribeSettingsForm() |
|
|
|
|
setting = contact.contactsettings |
|
|
|
|
@ -94,7 +100,7 @@ def save_announce_settings(request): |
|
|
|
|
# todo: subscribe settings error handle |
|
|
|
|
#not_valid |
|
|
|
|
|
|
|
|
|
return HttpResponseRedirect(reverse('accounts_settings')) |
|
|
|
|
return HttpResponseRedirect(reverse('accounts_settings')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CalendarView(TemplateView): |
|
|
|
|
|