예제 #1
0
def user_settings(request):
    extra_context = user_settings_intialize(request)
    try:
        form = FormsForm.objects.get(slug=settings.ZORNA_USER_PROFILE_FORM)
        try:
            entry = form.entries.get(account__id=request.user.pk)
        except FormsFormEntry.DoesNotExist:
            entry = None
    except Exception as e:
        entry = None
    if entry:
        t = loader.get_template('account/user_card.html')
        columns, row = forms_get_entry(entry)
        c = RequestContext(request, {
            'row': row,
            'columns': columns,
            'account': request.user
        })
        extra_context['profile'] = t.render(c)
    else:
        extra_context['profile'] = ''

    context = RequestContext(request)
    return render_to_response('account/user_settings_home.html',
                              extra_context,
                              context_instance=context)
예제 #2
0
파일: forms_tags.py 프로젝트: somair/zorna
 def render(self, context):
     request = context['request']
     try:
         entry = FormsFormEntry.objects.select_related(depth=1).get(
             pk=self.entry)
         form = entry.form
         check = get_acl_for_model(form)
         if not check.viewer_formsform(form,
                                       request.user) and not isUserManager(
                                           request, form.workspace.slug):
             return ''
     except Exception as e:
         print e
         return ''
     columns, row = forms_get_entry(entry)
     panels = {'': {}}
     for panel in form.formsformpanel_set.all():
         panel.fields = []
         panels[panel.label] = panel
     for f in form.fields.visible():
         if f.panel:
             panels[f.panel.label].fields.append(row[f.slug])
         else:
             panels[''].setdefault('fields', []).append(row[f.slug])
     context[self.var_name] = panels
     return ''
예제 #3
0
 def render(self, context):
     try:
         form = FormsForm.objects.get(slug=settings.ZORNA_USER_PROFILE_FORM)
         try:
             entry = form.entries.get(
                 account__id=self.user_varname.resolve(context))
         except FormsFormEntry.DoesNotExist:
             entry = None
     except Exception as e:
         entry = None
     if entry:
         context[self.columns_varname], context[
             self.rows_varname] = forms_get_entry(entry)
     else:
         context[self.columns_varname] = None
         context[self.rows_varname] = None
     return ''
예제 #4
0
파일: views.py 프로젝트: kamni/zorna
def user_settings(request):
    extra_context = user_settings_intialize(request)
    try:
        form = FormsForm.objects.get(slug=settings.ZORNA_USER_PROFILE_FORM)
        try:
            entry = form.entries.get(account__id=request.user.pk)
        except FormsFormEntry.DoesNotExist:
            entry = None
    except Exception as e:
        entry = None
    if entry:
        t = loader.get_template('account/user_card.html')
        columns, row = forms_get_entry(entry)
        c = RequestContext(request, {
                           'row': row, 'columns': columns, 'account': request.user})
        extra_context['profile'] = t.render(c)
    else:
        extra_context['profile'] = ''

    context = RequestContext(request)
    return render_to_response('account/user_settings_home.html', extra_context, context_instance=context)
예제 #5
0
파일: forms_tags.py 프로젝트: kamni/zorna
 def render(self, context):
     request = context['request']
     try:
         entry = FormsFormEntry.objects.select_related(depth=1).get(pk=self.entry)
         form = entry.form
         check = get_acl_for_model(form)
         if not check.viewer_formsform(form, request.user) and not isUserManager(request, form.workspace.slug):
             return ''
     except Exception as e:
         print e
         return ''
     columns, row = forms_get_entry(entry)
     panels = {'':{}}
     for panel in form.formsformpanel_set.all():
         panel.fields = []
         panels[panel.label] = panel
     for f in form.fields.visible():
         if f.panel:
             panels[f.panel.label].fields.append(row[f.slug])
         else:
             panels[''].setdefault('fields', []).append(row[f.slug])
     context[self.var_name] = panels
     return ''