Esempio n. 1
0
 def paginator(self, djp, wrapper, qs, display):
     for obj in qs:
         object  = obj.object
         opts    = object._meta
         appmodel = appsite.site.for_model(object.__class__)
         
         if display == 'detail':
             if appmodel:
                 yield appmodel.render_object(djp, wrapper)
             else:
                 yield loader.render_to_string(['%s/%s.html' % (opts.app_label,opts.module_name),
                                                'djpcms/components/object.html'],
                                                {'item':object})
         
         url     = None
         r       = ''
         try:
             url     = object.url
         except:
             appmodel = appsite.site.for_model(object.__class__)
             if appmodel:
                 url     = appmodel.viewurl(djp.request,object)
         if url:
             try:
                 name = object.name
                 if not name:
                     name = str(object)
             except:
                 name = str(object)
             link    = htmlwrap('a', name)
             link._attrs['title'] = name
             link._attrs['href'] = url
             if not url.startswith('/'):
                 link._attrs['target'] = "_blank"
             r = link.render()
         
         yield r
Esempio n. 2
0
from djpcms.utils import form_kwargs
from djpcms.utils.html import htmlwrap, box
from djpcms.utils.uniforms import FormLayout, Html, Fieldset, inlineLabels, ModelFormInlineHelper
from djpcms.forms import ModelMultipleChoiceField
from djpcms.views.apps.tagging import TagField

from flowrepo.models import Report, Attachment, Image
from flowrepo.forms import FlowItemForm, add_related_upload
from flowrepo import markups

from jflow.db.instdata.models import DataId, EconometricAnalysis, VendorId


CRL_HELP = htmlwrap('div',
                    htmlwrap('div',markups.help()).addClass('body').render()
                   ).addClasses('flowitem report').render()


collapse = lambda title, html, c, cl: box(hd = title, bd = html, collapsable = c, collapsed = cl)

class ReportForm(FlowItemForm):
    authors  = ModelMultipleChoiceField(User.objects, required = False)
    data_ids = ModelMultipleChoiceField(DataId.objects.all(),
                                        required = False, label = 'Related securities')
    attachments  = ModelMultipleChoiceField(Attachment.objects,
                                            required = False,
                                            label = 'Available attachments',
                                            help_text = 'To select/deselect multiple files to attach press ctrl')
    images       = ModelMultipleChoiceField(Image.objects, required = False, label = 'Available images',
                                            help_text = 'To select/deselect multiple files to attach press ctrl')
Esempio n. 3
0
File: forms.py Progetto: smhjn/flow
from django.contrib.auth.models import User

from djpcms.utils import form_kwargs
from djpcms.utils.html import htmlwrap, box
from djpcms.utils.uniforms import FormLayout, Html, Fieldset, inlineLabels, ModelFormInlineHelper
from djpcms.forms import ModelMultipleChoiceField
from djpcms.views.apps.tagging import TagField

from flowrepo.models import Report, Attachment, Image
from flowrepo.forms import FlowItemForm, add_related_upload
from flowrepo import markups

from jflow.db.instdata.models import DataId, EconometricAnalysis, VendorId

CRL_HELP = htmlwrap(
    'div',
    htmlwrap('div', markups.help()).addClass('body').render()).addClasses(
        'flowitem report').render()

collapse = lambda title, html, c, cl: box(
    hd=title, bd=html, collapsable=c, collapsed=cl)


class ReportForm(FlowItemForm):
    authors = ModelMultipleChoiceField(User.objects, required=False)
    data_ids = ModelMultipleChoiceField(DataId.objects.all(),
                                        required=False,
                                        label='Related securities')
    attachments = ModelMultipleChoiceField(
        Attachment.objects,
        required=False,
        label='Available attachments',