Пример #1
0
                for value in values:
                    row.append(value)

            csv_writer.writerow(row, )
            # closing of this row..
            # write header if first row
            # write data

        # closing out file...


def export(request):
    # get exporter given requst

    exporter = Exporter()
    resp = HttpReponse()

    gen = exporter.export(resp)

    return resp


# initialize the registry that will contain all classes for this type of
# registry
registry = loader.Registry()

# this will be invoked when it is imported by models.py to use the
# registry choices
loader.autodiscover('exporters')
Пример #2
0
            - a Q object containing the condition (or multiple)
            - a dict of annotations to be used downstream

        It should be noted that no checks are performed to prevent the same
        name being used for annotations.
        """
        operator, value = self.validate(definition, roperator, rvalue, **context)
        condition = self._condition(definition, operator, value, using)

        meta = {
            'condition': condition,
            'annotations': {},
            'cleaned_data': {
                'operator': operator,
                'value': value
            },
            'raw_data': {
                'operator': roperator,
                'value': rvalue,
            }
        }

        return meta


registry = loader.Registry(default=Translator)

# this will be invoked when it is imported by models.py to use the
# registry choices
loader.autodiscover('translators')
Пример #3
0
                tok = self.none

            # convert bools to their yes/no equivalents 
            elif type(value) is bool:
                tok = 'yes' if value else 'no'

            else:
                tok = self.to_string(name, value, definition, concept, **context)

            new_values.append(tok)

        return OrderedDict({'name': {'name': concept.name,
            'value': ' '.join(new_values), 'definition': definition}})

    to_html.none = '<span class="no-data">{no data}</span>'

    # this is a sensible default since HTML focuses more on "marking up" the
    # values with some semantic and/or visual relationship. since HTML has no
    # notion of a data structure, all values should usually be processed
    # together
    to_html.process_multiple = True


# initialize the registry that will contain all classes for this type of
# registry
registry = loader.Registry(default=Formatter)

# this will be invoked when it is imported by models.py to use the
# registry choices
loader.autodiscover('formatters')