当前位置: 首页>>代码示例>>Python>>正文


Python s3crud.S3CRUD类代码示例

本文整理汇总了Python中s3.s3crud.S3CRUD的典型用法代码示例。如果您正苦于以下问题:Python S3CRUD类的具体用法?Python S3CRUD怎么用?Python S3CRUD使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了S3CRUD类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: latest_records

def latest_records(resource, layout, listid, limit, list_fields, orderby):
    """
        Display a dataList of the latest records for a resource
    """

    #orderby = resource.table[orderby]
    datalist, numrows, ids = resource.datalist(fields=list_fields,
                                               start=None,
                                               limit=limit,
                                               listid=listid,
                                               orderby=orderby,
                                               layout=layout)
    if numrows == 0:
        # Empty table or just no match?
        table = resource.table
        if "deleted" in table:
            available_records = current.db(table.deleted != True)
        else:
            available_records = current.db(table._id > 0)
        if available_records.select(table._id,
                                    limitby=(0, 1)).first():
            msg = DIV(S3CRUD.crud_string(resource.tablename,
                                         "msg_no_match"),
                      _class="empty")
        else:
            msg = DIV(S3CRUD.crud_string(resource.tablename,
                                         "msg_list_empty"),
                      _class="empty")
        data = msg
    else:
        # Render the list
        dl = datalist.html()
        data = dl

    return data
开发者ID:abhi12ravi,项目名称:eden,代码行数:35,代码来源:controllers.py

示例2: latest_4_posts

 def latest_4_posts(series_filter, layout):
     resource.add_filter(S3FieldSelector("series_id$name") == series_filter)
     list_fields = ["series_id",
                    "location_id",
                    "date",
                    "body",
                    "created_by",
                    "created_by$organisation_id",
                    "document.file",
                    "event_post.event_id",
                    ]
     orderby = resource.table.date
     resource.add_filter(resource.table.date >= current.request.now)
     datalist, numrows, ids = resource.datalist(fields=list_fields,
                                                start=None,
                                                limit=4,
                                                listid="news_datalist",
                                                orderby=orderby,
                                                layout=layout)
     if numrows == 0:
         # Empty table or just no match?
         table = resource.table
         if "deleted" in table:
             available_records = current.db(table.deleted != True)
         else:
             available_records = current.db(table._id > 0)
         if available_records.select(table._id,
                                     limitby=(0, 1)).first():
             msg = DIV(S3CRUD.crud_string(resource.tablename,
                                          "msg_no_match"),
                       _class="empty")
         else:
             msg = DIV(S3CRUD.crud_string(resource.tablename,
                                          "msg_list_empty"),
                       _class="empty")
         data = msg
     else:
         # Render the list
         dl = datalist.html()
         data = dl
     return data
开发者ID:Sharad001,项目名称:eden,代码行数:41,代码来源:controllers.py

示例3: testPopupLink

    def testPopupLink(self):
        """ Test S3PopupLink """

        auth = current.auth
        deployment_settings = current.deployment_settings

        comment = S3PopupLink(c="pr", f="person")

        # If the module is active, the comment should always be active
        self.assertEqual(comment.check_active(),
                         deployment_settings.has_module("pr"))
        self.assertEqual(comment.method, "create")

        # Label should fall back to CRUD string
        from s3.s3crud import S3CRUD
        crud_string = S3CRUD.crud_string("pr_person", "label_create")
        self.assertEqual(comment.label, crud_string)

        if "inv" in deployment_settings.modules:
            comment = S3PopupLink(c="inv", f="inv_item")
            # Deactivate module
            inv = deployment_settings.modules["inv"]
            del deployment_settings.modules["inv"]
            # Comment should auto-deactivate
            self.assertFalse(comment.check_active())
            # Restore module
            deployment_settings.modules["inv"] = inv
            # Comment should auto-reactivate
            self.assertTrue(comment.check_active())

        self.assertFalse(comment.check_permission())
        self.assertEqual(comment.xml(), "")
        auth.s3_impersonate("[email protected]")
        self.assertTrue(comment.check_permission())
        output = comment.xml()
        self.assertTrue(type(output) is str)
        self.assertNotEqual(output, "")
        auth.s3_impersonate(None)
开发者ID:bst99,项目名称:eden,代码行数:38,代码来源:s3layouts_tests.py

示例4: homepage


#.........这里部分代码省略.........
                                      represent="%(name)s",
                                      cols=3),
                      S3OptionsFilter("location_id",
                                      label=T("Filter by Location"),
                                      represent="%(name)s",
                                      widget="multiselect",
                                      cols=3),
                      S3OptionsFilter("created_by$organisation_id",
                                      label=T("Filter by Organization"),
                                      represent="%(name)s",
                                      widget="multiselect",
                                      cols=3),
                      S3DateFilter("created_on",
                                   label=T("Filter by Date")),
                      ]

    s3db.configure("cms_post",
                   filter_formstyle = filter_formstyle,
                   filter_submit = (T("Filter Results"), "btn btn-primary"),
                   filter_widgets = filter_widgets,
                   list_layout = list_layout,
                   )

    s3.dl_pagelength = 6  # 5 forces an AJAX call

    if "datalist_dl_post" in request.args:
        ajax = True
    else:
        ajax = False

    def prep(r):
        if ajax:
            r.representation = "dl"
        return True
    s3.prep = prep

    request.args = ["datalist"]
    output = current.rest_controller("cms", "post",
                                     list_ajaxurl = URL(f="index", args="datalist_dl_post"))

    if ajax:
        response.view = "plain.html"
    else:
        form = output["form"]
        # Remove duplicate Submit button
        form[0][-1] = ""
        if form.errors:
            s3.jquery_ready.append('''$("#myModal").modal("show")''')
        # Set Title & View after REST Controller, in order to override
        output["title"] = response.title = current.deployment_settings.get_system_name()
        view = path.join(request.folder, "private", "templates",
                         "CSN", "views", "index.html")
        try:
            # Pass view as file not str to work in compiled mode
            response.view = open(view, "rb")
        except IOError:
            from gluon.http import HTTP
            raise HTTP("404", "Unable to open Custom View: %s" % view)

        # Latest 5 Disasters
        resource = s3db.resource("event_event")
        list_fields = ["name",
                       "zero_hour",
                       "closed",
                       ]
        orderby = resource.get_config("list_orderby",
                                      ~resource.table.created_on)
        datalist, numrows, ids = resource.datalist(fields=list_fields,
                                                   start=None,
                                                   limit=5,
                                                   listid="event_datalist",
                                                   orderby=orderby,
                                                   layout=render_homepage_events)
        if numrows == 0:
            # Empty table or just no match?

            table = resource.table
            if "deleted" in table:
                available_records = current.db(table.deleted != True)
            else:
                available_records = current.db(table._id > 0)
            if available_records.select(table._id,
                                        limitby=(0, 1)).first():
                msg = DIV(S3CRUD.crud_string(resource.tablename,
                                             "msg_no_match"),
                          _class="empty")
            else:
                msg = DIV(S3CRUD.crud_string(resource.tablename,
                                             "msg_list_empty"),
                          _class="empty")
            data = msg

        else:
            # Render the list
            dl = datalist.html()
            data = dl

        output["disasters"] = data

    return output
开发者ID:dvabhishek,项目名称:eden,代码行数:101,代码来源:controllers.py

示例5: __call__

    def __call__(self):

        T = current.T
        db = current.db
        s3db = current.s3db
        request = current.request
        response = current.response
        s3 = response.s3

        output = {}
        output["title"] = response.title = current.deployment_settings.get_system_name()

        # Map
        auth = current.auth
        is_logged_in = auth.is_logged_in()
        callback = None
        if is_logged_in:
            # Show the User's Coalition's Polygon
            org_group_id = auth.user.org_group_id
            if org_group_id:
                # Lookup Coalition Name
                table = s3db.org_group
                row = db(table.id == org_group_id).select(table.name,
                                                          limitby=(0, 1)
                                                          ).first()
                if row:
                    callback = '''S3.gis.show_map();
var layer,layers=S3.gis.maps.default_map.layers;
for(var i=0,len=layers.length;i<len;i++){
 layer=layers[i];
 if(layer.name=='%s'){layer.setVisibility(true)}}''' % row.name
        if not callback:
            # Show all Coalition Polygons
            callback = '''S3.gis.show_map();
var layer,layers=S3.gis.maps.default_map.layers;
for(var i=0,len=layers.length;i<len;i++){
 layer=layers[i];
 if(layer.name=='All Coalitions'){layer.setVisibility(true)}}
'''
        gis = current.gis
        config = gis.get_config()
        config.zoom = 8
        map = gis.show_map(width=770,
                           height=295,
                           callback=callback,
                           catalogue_layers=True,
                           collapsed=True,
                           save=False,
                           )
        output["map"] = map

        # Description of available data
        from s3db.cms import S3CMS
        for item in response.menu:
            item["cms"] = S3CMS.resource_content(module = item["c"], 
                                                 resource = item["f"])

        # Site Activity Log
        resource = s3db.resource("s3_audit")
        resource.add_filter(FS("~.method") != "delete")
        orderby = "s3_audit.timestmp desc"
        list_fields = ["id",
                       "method",
                       "user_id",
                       "tablename",
                       "record_id",
                       ]
        #current.deployment_settings.ui.customise_s3_audit()
        db.s3_audit.user_id.represent = s3_auth_user_represent_name
        list_id = "log"
        datalist, numrows, ids = resource.datalist(fields=list_fields,
                                                   start=None,
                                                   limit=4,
                                                   list_id=list_id,
                                                   orderby=orderby,
                                                   layout=s3.render_log)

        # Placeholder
        filter_form = DIV(_class="filter_form")
        if numrows == 0:
            # Empty table or just no match?
            from s3.s3crud import S3CRUD
            table = resource.table
            if "deleted" in table:
                available_records = db(table.deleted != True)
            else:
                available_records = db(table._id > 0)
            if available_records.select(table._id,
                                        limitby=(0, 1)).first():
                msg = DIV(S3CRUD.crud_string(resource.tablename,
                                             "msg_no_match"),
                          _class="empty")
            else:
                msg = DIV(S3CRUD.crud_string(resource.tablename,
                                             "msg_list_empty"),
                          _class="empty")
            data = msg
        else:
            # Render the list
            ajaxurl = URL(c="default", f="audit", args="datalist_f.dl")
#.........这里部分代码省略.........
开发者ID:BhagyaGH,项目名称:eden,代码行数:101,代码来源:controllers.py

示例6: __call__

    def __call__(self):

        response = current.response
        output = {}
        #output["title"] = response.title = current.deployment_settings.get_system_name()
        view = path.join(current.request.folder, "private", "templates",
                         THEME, "views", "index.html")
        try:
            # Pass view as file not str to work in compiled mode
            response.view = open(view, "rb")
        except IOError:
            from gluon.http import HTTP
            raise HTTP("404", "Unable to open Custom View: %s" % view)

        s3 = response.s3
        # Image Carousel
        s3.jquery_ready.append('''$('#myCarousel').carousel()''')

        if current.auth.is_logged_in():
            s3db = current.s3db
            # Latest 4 Events
            resource = s3db.resource("cms_post")
            resource.add_filter(S3FieldSelector("series_id$name") == "Event")
            list_fields = ["location_id",
                           "date",
                           "body",
                           "created_by",
                           "created_by$organisation_id",
                           "document.file",
                           "event_post.event_id",
                           ]
            orderby = resource.get_config("list_orderby",
                                          ~resource.table.date)
            datalist, numrows, ids = resource.datalist(fields=list_fields,
                                                       start=None,
                                                       limit=4,
                                                       listid="event_datalist",
                                                       orderby=orderby,
                                                       layout=render_cms_events)
            if numrows == 0:
                # Empty table or just no match?
                table = resource.table
                if "deleted" in table:
                    available_records = current.db(table.deleted != True)
                else:
                    available_records = current.db(table._id > 0)
                if available_records.select(table._id,
                                            limitby=(0, 1)).first():
                    msg = DIV(S3CRUD.crud_string(resource.tablename,
                                                 "msg_no_match"),
                              _class="empty")
                else:
                    msg = DIV(S3CRUD.crud_string(resource.tablename,
                                                 "msg_list_empty"),
                              _class="empty")
                data = msg
            else:
                # Render the list
                dl = datalist.html()
                data = dl
            output["events"] = data

            # Latest 4 Updates
            resource = s3db.resource("cms_post")
            list_fields = ["series_id",
                           "location_id",
                           "date",
                           "body",
                           "created_by",
                           "created_by$organisation_id",
                           "document.file",
                           "event_post.event_id",
                           ]
            orderby = resource.get_config("list_orderby",
                                          ~resource.table.date)
            datalist, numrows, ids = resource.datalist(fields=list_fields,
                                                       start=None,
                                                       limit=4,
                                                       listid="news_datalist",
                                                       orderby=orderby,
                                                       layout=s3.render_posts)
            if numrows == 0:
                # Empty table or just no match?
                table = resource.table
                if "deleted" in table:
                    available_records = current.db(table.deleted != True)
                else:
                    available_records = current.db(table._id > 0)
                if available_records.select(table._id,
                                            limitby=(0, 1)).first():
                    msg = DIV(S3CRUD.crud_string(resource.tablename,
                                                 "msg_no_match"),
                              _class="empty")
                else:
                    msg = DIV(S3CRUD.crud_string(resource.tablename,
                                                 "msg_list_empty"),
                              _class="empty")
                data = msg
            else:
                # Render the list
#.........这里部分代码省略.........
开发者ID:FenilKavathia,项目名称:eden,代码行数:101,代码来源:controllers.py

示例7: _updates


#.........这里部分代码省略.........
                   filter_widgets = filter_widgets,
                   list_layout = list_layout,
                   # Create form comes via AJAX in a Modal
                   insertable = False,
                   )

    s3.dl_pagelength = 6  # 5 forces an AJAX call

    if "datalist_dl_post" in request.args:
        # DataList pagination or Ajax-deletion request
        request.args = ["datalist_f"]
        ajax = "list"
    elif "datalist_dl_filter" in request.args:
        # FilterForm options update request
        request.args = ["filter"]
        ajax = "filter"
    elif "validate.json" in request.args:
        ajax = True
    else:
        # Default
        request.args = ["datalist_f"]
        ajax = None

    def prep(r):
        if ajax == "list":
            r.representation = "dl"
        elif ajax == "filter":
            r.representation = "json"
        return True
    s3.prep = prep

    output = current.rest_controller("cms", "post",
                                     list_ajaxurl = URL(f="index",
                                                        args="datalist_dl_post"),
                                     filter_ajax_url = URL(f="index",
                                                           args="datalist_dl_filter",
                                                           vars={}))

    if ajax == "list":
        # Don't override view if this is an Ajax-deletion request
        if not "delete" in request.get_vars:
            response.view = "plain.html"
    elif not ajax:
        # Set Title & View after REST Controller, in order to override
        output["title"] = T("News Feed")
        view = path.join(request.folder, "private", "templates",
                         THEME, "views", "updates.html")
        try:
            # Pass view as file not str to work in compiled mode
            response.view = open(view, "rb")
        except IOError:
            from gluon.http import HTTP
            raise HTTP("404", "Unable to open Custom View: %s" % view)

        scripts = []
        sappend = scripts.append
        # Style the Search TextFilter widget
        sappend('''$('#post-cms_post_body-text-filter__row').addClass('input-append').append('<span class="add-on"><i class="icon-search"></i></span>')''')
        # Button to toggle Advanced Form
        sappend('''$('#list-filter').append('<a class="accordion-toggle"><i class="icon-reorder"></i> %s</a>')''' % T("Advanced Search"))
        sappend('''$('.accordion-toggle').click(function(){$('.advanced').toggle()})''')
        s3.jquery_ready.append('''\n'''.join(scripts))
        
        # Latest 5 Disasters
        resource = s3db.resource("event_event")
        list_fields = ["name",
                       "event_type_id$name",
                       "zero_hour",
                       "closed",
                       ]
        orderby = resource.get_config("list_orderby",
                                      ~resource.table.created_on)
        datalist, numrows, ids = resource.datalist(fields=list_fields,
                                                   start=None,
                                                   limit=5,
                                                   listid="event_datalist",
                                                   orderby=orderby,
                                                   layout=render_events)
        # Render the list
        data = datalist.html()
        if numrows == 0:
            # Empty table or just no match?
            table = resource.table
            if "deleted" in table:
                available_records = current.db(table.deleted != True)
            else:
                available_records = current.db(table._id > 0)
            if available_records.select(table._id,
                                        limitby=(0, 1)).first():
                msg = DIV(S3CRUD.crud_string(resource.tablename,
                                             "msg_no_match"),
                          _class="empty")
            else:
                msg = DIV(S3CRUD.crud_string(resource.tablename,
                                             "msg_list_empty"),
                          _class="empty")
            data.insert(1, msg)
        output["disasters"] = data

    return output
开发者ID:FenilKavathia,项目名称:eden,代码行数:101,代码来源:controllers.py

示例8: __call__


#.........这里部分代码省略.........
        list_fields = s3db.get_config("req_req", "list_fields")
        layout = s3db.req_req_list_layout
        resource.add_filter(FS("cancel") != True)
        # Order with most recent Request first
        orderby = "date desc"
        output["latest_reqs"] = latest_records(resource, layout, list_id, limit, list_fields, orderby)

        # Site Activity Log
        from s3.s3utils import s3_auth_user_represent_name
        resource = s3db.resource("s3_audit")
        resource.add_filter(FS("~.method") != "delete")
        orderby = "s3_audit.timestmp desc"
        list_fields = ["id",
                       "method",
                       "user_id",
                       "tablename",
                       "record_id",
                       ]
        #current.deployment_settings.ui.customise_s3_audit()
        db = current.db
        db.s3_audit.user_id.represent = s3_auth_user_represent_name
        list_id = "log"
        datalist, numrows, ids = resource.datalist(fields=list_fields,
                                                   start=None,
                                                   limit=4,
                                                   list_id=list_id,
                                                   orderby=orderby,
                                                   layout=s3.render_log)

        # Placeholder
        filter_form = DIV(_class="filter_form")
        if numrows == 0:
            # Empty table or just no match?
            from s3.s3crud import S3CRUD
            table = resource.table
            if "deleted" in table:
                available_records = db(table.deleted != True)
            else:
                available_records = db(table._id > 0)
            if available_records.select(table._id,
                                        limitby=(0, 1)).first():
                msg = DIV(S3CRUD.crud_string(resource.tablename,
                                             "msg_no_match"),
                          _class="empty")
            else:
                msg = DIV(S3CRUD.crud_string(resource.tablename,
                                             "msg_list_empty"),
                          _class="empty")
            data = msg
        else:
            # Render the list
            ajaxurl = URL(c="default", f="audit", args="datalist_f.dl")
            popup_url = URL(c="default", f="audit", args="datalist.popup")
            dl = datalist.html(ajaxurl=ajaxurl,
                               pagesize=4,
                               popup_url=popup_url,
                               popup_title=T("Updates"),
                               )
            data = dl

            if auth.s3_logged_in() and auth.user.org_group_id:
                # Add a Filter
                from s3.s3filter import S3OptionsFilter, S3FilterForm
                filter_widgets = [S3OptionsFilter("user_id$org_group_id",
                                                  label = "",
                                                  # Can't just use "" as this is then omitted from rendering
开发者ID:DarshanMn,项目名称:eden,代码行数:67,代码来源:controllers.py

示例9: __call__

    def __call__(self):

        response = current.response
        
        output = {}
        #output["title"] = response.title = current.deployment_settings.get_system_name()

        s3 = response.s3
        # Image Carousel
        s3.jquery_ready.append('''$('#myCarousel').carousel()''')

        if current.auth.is_logged_in():
            s3db = current.s3db
            # Latest 4 Events
            resource = s3db.resource("cms_post")
            resource.add_filter(S3FieldSelector("series_id$name") == "Event")
            list_fields = ["location_id",
                           "date",
                           "body",
                           "created_by",
                           "created_by$organisation_id",
                           "document.file",
                           "event_post.event_id",
                           ]
            orderby = resource.get_config("list_orderby",
                                          ~resource.table.date)
            datalist, numrows, ids = resource.datalist(fields=list_fields,
                                                       start=None,
                                                       limit=4,
                                                       listid="event_datalist",
                                                       orderby=orderby,
                                                       layout=render_cms_events)
            if numrows == 0:
                # Empty table or just no match?
                table = resource.table
                if "deleted" in table:
                    available_records = current.db(table.deleted != True)
                else:
                    available_records = current.db(table._id > 0)
                if available_records.select(table._id,
                                            limitby=(0, 1)).first():
                    msg = DIV(S3CRUD.crud_string(resource.tablename,
                                                 "msg_no_match"),
                              _class="empty")
                else:
                    msg = DIV(S3CRUD.crud_string(resource.tablename,
                                                 "msg_list_empty"),
                              _class="empty")
                data = msg
            else:
                # Render the list
                dl = datalist.html()
                data = dl
            output["events"] = data

            # Latest 4 Updates
            resource = s3db.resource("cms_post")
            list_fields = ["series_id",
                           "location_id",
                           "date",
                           "body",
                           "created_by",
                           "created_by$organisation_id",
                           "document.file",
                           "event_post.event_id",
                           ]
            orderby = resource.get_config("list_orderby",
                                          ~resource.table.date)
            datalist, numrows, ids = resource.datalist(fields=list_fields,
                                                       start=None,
                                                       limit=4,
                                                       listid="news_datalist",
                                                       orderby=orderby,
                                                       layout=s3.render_posts)
            if numrows == 0:
                # Empty table or just no match?
                table = resource.table
                if "deleted" in table:
                    available_records = current.db(table.deleted != True)
                else:
                    available_records = current.db(table._id > 0)
                if available_records.select(table._id,
                                            limitby=(0, 1)).first():
                    msg = DIV(S3CRUD.crud_string(resource.tablename,
                                                 "msg_no_match"),
                              _class="empty")
                else:
                    msg = DIV(S3CRUD.crud_string(resource.tablename,
                                                 "msg_list_empty"),
                              _class="empty")
                data = msg
            else:
                # Render the list
                dl = datalist.html()
                data = dl
            output["news"] = data

        self._view(THEME, "index.html")
        return output
开发者ID:LMcule,项目名称:eden,代码行数:99,代码来源:controllers.py

示例10: _updates


#.........这里部分代码省略.........
                      S3DateFilter("created_on",
                                   label=T("Filter by Date"),
                                   hide_time=True),
                      ]

    s3db.configure("cms_post",
                   filter_formstyle = filter_formstyle,
                   filter_submit = (T("Filter Results"), "btn btn-primary"),
                   filter_widgets = filter_widgets,
                   list_layout = list_layout,
                   # Create form comes via AJAX in a Modal
                   insertable = False,
                   )

    s3.dl_pagelength = 6  # 5 forces an AJAX call

    if "datalist_dl_post" in request.args:
        # DataList pagination or Ajax-deletion request
        request.args = ["datalist_f"]
        ajax = "list"
    elif "datalist_dl_filter" in request.args:
        # FilterForm options update request
        request.args = ["filter"]
        ajax = "filter"
    elif "validate.json" in request.args:
        ajax = True
    else:
        # Default
        request.args = ["datalist_f"]
        ajax = None

    def prep(r):
        if ajax == "list":
            r.representation = "dl"
        elif ajax == "filter":
            r.representation = "json"
        return True
    s3.prep = prep

    output = current.rest_controller("cms", "post",
                                     list_ajaxurl = URL(f="index",
                                                        args="datalist_dl_post"),
                                     filter_ajax_url = URL(f="index",
                                                           args="datalist_dl_filter",
                                                           vars={}))

    if ajax == "list":
        # Don't override view if this is an Ajax-deletion request
        if not "delete" in request.get_vars:
            response.view = "plain.html"
    elif not ajax:
        # Set Title & View after REST Controller, in order to override
        output["title"] = response.title = current.deployment_settings.get_system_name()
        view = path.join(request.folder, "private", "templates",
                         THEME, "views", "updates.html")
        try:
            # Pass view as file not str to work in compiled mode
            response.view = open(view, "rb")
        except IOError:
            from gluon.http import HTTP
            raise HTTP("404", "Unable to open Custom View: %s" % view)

        # Latest 5 Disasters
        resource = s3db.resource("event_event")
        list_fields = ["name",
                       "zero_hour",
                       "closed",
                       ]
        orderby = resource.get_config("list_orderby",
                                      ~resource.table.created_on)
        datalist, numrows, ids = resource.datalist(fields=list_fields,
                                                   start=None,
                                                   limit=5,
                                                   listid="event_datalist",
                                                   orderby=orderby,
                                                   layout=render_events)
        if numrows == 0:
            # Empty table or just no match?
            table = resource.table
            if "deleted" in table:
                available_records = current.db(table.deleted != True)
            else:
                available_records = current.db(table._id > 0)
            if available_records.select(table._id,
                                        limitby=(0, 1)).first():
                msg = DIV(S3CRUD.crud_string(resource.tablename,
                                             "msg_no_match"),
                          _class="empty")
            else:
                msg = DIV(S3CRUD.crud_string(resource.tablename,
                                             "msg_list_empty"),
                          _class="empty")
            data = msg
        else:
            # Render the list
            dl = datalist.html()
            data = dl
        output["disasters"] = data

    return output
开发者ID:jonathlt,项目名称:eden,代码行数:101,代码来源:controllers.py


注:本文中的s3.s3crud.S3CRUD类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。