Beispiel #1
0
from notebook.notes.models import create_model, create_model_form
from notebook.scraps.models import Scrap, Folder
from notebook.notes.views import getT, getW, getNote, get_public_notes, get_public_tags, remove_private_tag_notes, __get_ws_tags 
from notebook.notes.views import folders_index, settings_tag_add, settings_tag_update, settings_tag, settings_tags
from notebook.notes.views import getSearchResults, getlogger,  __getQStr, __get_notes_context
from notebook.notes.views import __get_folder_context, __get_pre_url

import notebook

import datetime
from datetime import date



log = getlogger('scraps.views')


#this method is used for processing the request users send via the browser button    
@login_required 
def add_scrap(request):
    username = request.user.username
    N = getNote(username, 'scrapbook')
    T = getT(username)
    #W = getW(username)
    #w = W.objects.get(name='scrapbook')  
    if request.method == 'POST': 
        tags = T.objects.all()
        #form require tags to be required. So don't use form now, and use the code from add_note in notebook.notes.views for adding a snippet
        #AddNForm = create_model_form("AddNForm_add_scrap_post_"+str(username), N, fields={'tags':forms.ModelMultipleChoiceField(queryset=tags)})     
        n = N() 
Beispiel #2
0
from django.contrib import messages
from django.forms import ModelForm

from notebook.notes.views import __get_ws_tags, getlogger, getNote, getT, getW, create_model_form
import notebook
from notebook.bookmarks.models import Bookmark


#TODO: below to be deleted later after merging linkage. This def is only used in fixdb.py
from notebook.notes.views import create_model
from notebook.bookmarks.models import Linkage_Of_Bookmark
def getL(username):
    return create_model("L_bookmarks_"+str(username), Linkage_Of_Bookmark, username)


log = getlogger('bookmarks.views')         




#this method is used for processing the request users send via the browser button  TODO: use code in add_note method 
#TODO: give error message if an error
@login_required    
def add_bookmark(request):
    username = request.user.username
    N = getNote(username, 'bookmarkbook')
    T = getT(username)
    #W = getW(username)
    #w = W.objects.get(name='bookmarkbook')
    if request.method == 'POST': 
        tags = T.objects.all()
Beispiel #3
0
from django.contrib.sites.models import Site
from django.template import RequestContext
from django.core.exceptions import ObjectDoesNotExist, FieldError
from django.core.mail import send_mass_mail

from django.db import connections,  transaction



from notebook.tags.models import *
from notebook.notes.constants import *
from notebook.social.models import Group_Tag_Frame, Group, Member
from notebook.notes.util import *
from notebook.notes.views import __get_pre_url, getlogger, __get_view_theme, __get_related_tags

log = getlogger('tags.views')  




class AddTagFrameForm(ModelForm):
    error_css_class = 'error'
    required_css_class = 'required'
    class Meta:
        model = Tag_Frame  
        exclude = ('tags', 'current')    
        


def index(request, username): 
    if username == 'anonymous':
Beispiel #4
0
from django.template import RequestContext
from django.core.exceptions import ObjectDoesNotExist, FieldError
from django.core.mail import send_mass_mail

from django.db import connections,  transaction



from notebook.areas.models import *
from notebook.notes.views import __get_pre_url, getlogger, __get_view_theme, __getQStr, getSearchResults, __get_context 
from notebook.social.models import Member, Social_Area
from notebook.notes.util import *
from notebook.notes.constants import *


log = getlogger('areas.views')  





class AddAreaForm(ModelForm):
    error_css_class = 'error'
    required_css_class = 'required'
    class Meta:
        model = Area  
        

    
def index(request): 
    areas = Social_Area.objects.all().order_by('-num_of_notes')
Beispiel #5
0
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib.sites.models import Site
from django.template import RequestContext
from django.core.exceptions import ObjectDoesNotExist, FieldError
from django.core.mail import send_mass_mail

from django.db import connections, transaction

from notebook.tags.models import *
from notebook.notes.constants import *
from notebook.social.models import Group_Tag_Frame, Group, Member
from notebook.notes.util import *
from notebook.notes.views import __get_pre_url, getlogger, __get_view_theme, __get_related_tags

log = getlogger('tags.views')


class AddTagFrameForm(ModelForm):
    error_css_class = 'error'
    required_css_class = 'required'

    class Meta:
        model = Tag_Frame
        exclude = ('tags', 'current')


def index(request, username):
    if username == 'anonymous':
        return HttpResponseRedirect('/login/')
    tag_tree, created = Tag_Frame.objects.using(username).get_or_create(
Beispiel #6
0
from notebook.notes.views import __get_ws_tags, getlogger, getNote, getT, getW, create_model_form
import notebook
from notebook.bookmarks.models import Bookmark

#TODO: below to be deleted later after merging linkage. This def is only used in fixdb.py
from notebook.notes.views import create_model
from notebook.bookmarks.models import Linkage_Of_Bookmark


def getL(username):
    return create_model("L_bookmarks_" + str(username), Linkage_Of_Bookmark,
                        username)


log = getlogger('bookmarks.views')


#this method is used for processing the request users send via the browser button  TODO: use code in add_note method
#TODO: give error message if an error
@login_required
def add_bookmark(request):
    username = request.user.username
    N = getNote(username, 'bookmarkbook')
    T = getT(username)
    #W = getW(username)
    #w = W.objects.get(name='bookmarkbook')
    if request.method == 'POST':
        tags = T.objects.all()
        #the same as in add scrap code, here we don't use form because tags in from is required
        #AddNForm = create_model_form("AddNForm_"+str(username), N, fields={'tags':forms.ModelMultipleChoiceField(queryset=tags)})
Beispiel #7
0
from django.db.models import Q, F, Avg, Max, Min, Count
from django.db import connection
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.utils import simplejson
from django.utils.http import urlencode
from django.utils.translation import ugettext as _
from django.contrib import messages
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required, user_passes_test
from django.template import RequestContext
from django.core.exceptions import ObjectDoesNotExist, FieldError

from notebook.salons.models import *
from notebook.notes.views import __get_pre_url, getlogger

log = getlogger('salons.views')


class AddSalonForm(ModelForm):
    error_css_class = 'error'
    required_css_class = 'required'

    class Meta:
        model = Salon
        exclude = ('private', 'last_modi_date', 'status', 'fee')


def salons(request):
    past = request.GET.get('past')
    if past and past == 'y':
        salons = Salon.objects.filter(private=False).exclude(
Beispiel #8
0
from django.core.mail import send_mass_mail
from django.utils.translation import ugettext as _

from notebook.notes.models import create_model, create_model_form
from notebook.scraps.models import Scrap, Folder
from notebook.notes.views import getT, getW, getNote, get_public_notes, get_public_tags, remove_private_tag_notes, __get_ws_tags
from notebook.notes.views import folders_index, settings_tag_add, settings_tag_update, settings_tag, settings_tags
from notebook.notes.views import getSearchResults, getlogger, __getQStr, __get_notes_context
from notebook.notes.views import __get_folder_context, __get_pre_url

import notebook

import datetime
from datetime import date

log = getlogger('scraps.views')


#this method is used for processing the request users send via the browser button
@login_required
def add_scrap(request):
    username = request.user.username
    N = getNote(username, 'scrapbook')
    T = getT(username)
    #W = getW(username)
    #w = W.objects.get(name='scrapbook')
    if request.method == 'POST':
        tags = T.objects.all()
        #form require tags to be required. So don't use form now, and use the code from add_note in notebook.notes.views for adding a snippet
        #AddNForm = create_model_form("AddNForm_add_scrap_post_"+str(username), N, fields={'tags':forms.ModelMultipleChoiceField(queryset=tags)})
        n = N()
Beispiel #9
0
from django.utils import simplejson
from django.utils.http import urlencode
from django.utils.translation import ugettext as _
from django.contrib import messages
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required, user_passes_test
from django.template import RequestContext
from django.core.exceptions import ObjectDoesNotExist, FieldError


from notebook.salons.models import *
from notebook.notes.views import __get_pre_url, getlogger



log = getlogger('salons.views')  


    

class AddSalonForm(ModelForm):
    error_css_class = 'error'
    required_css_class = 'required'    
    class Meta:
        model = Salon  
        exclude = ('private', 'last_modi_date', 'status', 'fee') 
        

def salons(request):    
    past = request.GET.get('past')
    if past and past=='y':