Пример #1
0
def csv(request, format='csv'):
    if request.user.has_perm('contacts.can_view'):
        return export(Contact.objects.all(), \
            ['id','node_ptr','first_seen','reporter.first_name','reporter.last_name',\
             'common_name','reporter.alias','location','gender','age_months','_locale'])
    return export(Contact.objects.all(), \
        ['id','node_ptr','first_seen','location','gender','age_months','_locale'])
Пример #2
0
def csv(request, format='csv'):
    if request.user.has_perm('contacts.can_view'):
        return export(Contact.objects.all().order_by('node_pr'), 
            ['node_ptr','reporter.connection.identity', 'common_name',
             'messages.sent', 'messages.received', 'first_seen', '_locale'])
    return export(Contact.objects.all().order_by('node_pr'), 
        ['node_ptr', 'messages.sent', 'messages.received', 'first_seen', '_locale'])
Пример #3
0
def csv(request, format='csv'):
    if request.user.is_authenticated():
        return export(Contact.objects.all(), \
            ['id','node_ptr','first_seen','given_name','family_name',\
             'common_name','unique_id','location','gender','age_months','_locale'])
    return export(Contact.objects.all(), \
        ['id','node_ptr','first_seen','location','gender','age_months','_locale'])
Пример #4
0
def csv_out(request, format='csv'):
    context = {}
    # HACK: creates a dependency on contacts
    # TODO - add a check for contacts app activated and fix
    if request.user.has_perm('contacts.can_view'):
    #if request.user.is_authenticated():
        return export(OutgoingMessage.objects.all())    
    return export(OutgoingMessage.objects.all(), ['id','text','backend','domains','sent'])
Пример #5
0
def export_village_membership(request, pk, format='csv'):
    village = Village.objects.get(id=pk)
    members = village.flatten(klass=Contact)
    if request.user.has_perm('contacts.can_view'):
        return export(members, ['first_seen', 'given_name', 'family_name', 
                                'common_name', 'reporter.alias', 'gender', 
                                'age_months', '_locale'])
    return export(members, ['first_seen', 'gender', 
                            'age_months', '_locale'])
Пример #6
0
def csv_entries(req, format="csv"):
    context = {}
    if req.user.is_authenticated():
        return export(SurveyEntry.objects.all())
    return export(
        SurveyEntry.objects.all(),
        [
            "Survey Date",
            "Interviewer ID",
            "Cluster ID",
            "Child ID",
            "Household ID",
            "Sex",
            "Date of Birth",
            "Age",
            "Height",
            "Weight",
            "Oedema",
            "MUAC",
        ],
    )
Пример #7
0
def csv_transfers(req, format="csv"):
    return export(AirtimeTransfer.objects.all())
Пример #8
0
def export_village_history(request, pk, format='csv'):
    village = Village.objects.get(id=pk)
    history = MembershipLog.objects.filter(village=village)
    if request.user.is_authenticated():
        return export(history, ['id','date','node','action'])
    return export(history, ['id','date','action'])
Пример #9
0
def csv_purchases(req, format='csv'):
    return export(AirtimeBundlePurchase.objects.all())
Пример #10
0
def export_village_history(request, pk, format='csv'):
    village = Village.objects.get(id=pk)
    history = MembershipLog.objects.filter(village=village)
    if request.user.has_perm('contacts.can_view'):
        return export(history, ['id','date','contact','action'])
    return export(history, ['id','date','action'])
Пример #11
0
def csv_out(req, format='csv'):
    context = {}
    if req.user.is_authenticated():
        return export(OutgoingMessage.objects.all())    
    return export(OutgoingMessage.objects.all(), ['id','text','backend','domain','sent'])
Пример #12
0
def csv_in(req, format='csv'):
    context = {}
    if req.user.is_authenticated():
        return export(IncomingMessage.objects.all())
    return export(IncomingMessage.objects.all(), ['id','text','backend','domain','received'])
Пример #13
0
def csv_transfers(req, format='csv'):
    return export(AirtimeTransfer.objects.all())