odk_logger/views.py
def formList(request, username):
    """
    This is where ODK Collect gets its download list.
    """
    if username.lower() == 'crowdforms':
        xforms = XForm.objects.filter(is_crowd_form=True)\
            .exclude(user__username=username)
    else:
        formlist_user = get_object_or_404(User, username=username)
        profile, created = \
            UserProfile.objects.get_or_create(user=formlist_user)

        if profile.require_auth:
            authenticator = HttpDigestAuthenticator()
            if not authenticator.authenticate(request):
                return authenticator.build_challenge_response()

            # unauthorized if user in auth request does not match user in path
            # unauthorized if user not active
            if formlist_user.username != request.user.username or\
                    not request.user.is_active:
                return HttpResponseNotAuthorized()

        xforms = \
            XForm.objects.filter(downloadable=True, user__username=username)
        # retrieve crowd_forms for this user
        crowdforms = XForm.objects.filter(
            metadata__data_type=MetaData.CROWDFORM_USERS,
            metadata__data_value=username
        )
        xforms = chain(xforms, crowdforms)
        audit = {}
        audit_log(Actions.USER_FORMLIST_REQUESTED, request.user, formlist_user,
                  _("Requested forms list."), audit, request)
    response = render_to_response("xformsList.xml", {
        #'urls': urls,
        'host': request.build_absolute_uri().replace(
            request.get_full_path(), ''),
        'xforms': xforms
    }, mimetype="text/xml; charset=utf-8")
    response['X-OpenRosa-Version'] = '1.0'
    tz = pytz.timezone(settings.TIME_ZONE)
    dt = datetime.now(tz).strftime('%a, %d %b %Y %H:%M:%S %Z')
    response['Date'] = dt
    return response

    This is where ODK Collect gets its download list.
    
This is where ODK Collect gets its download list.
This is where ODK Collect gets its download list .
def formList(request, username):
    if username.lower() == 'crowdforms':
        xforms = XForm.objects.filter(is_crowd_form=True)\
            .exclude(user__username=username)
    else:
        formlist_user = get_object_or_404(User, username=username)
        profile, created = \
            UserProfile.objects.get_or_create(user=formlist_user)
        if profile.require_auth:
            authenticator = HttpDigestAuthenticator()
            if not authenticator.authenticate(request):
                return authenticator.build_challenge_response()
            if formlist_user.username != request.user.username or\
                    not request.user.is_active:
                return HttpResponseNotAuthorized()
        xforms = \
            XForm.objects.filter(downloadable=True, user__username=username)
        crowdforms = XForm.objects.filter(
            metadata__data_type=MetaData.CROWDFORM_USERS,
            metadata__data_value=username
        )
        xforms = chain(xforms, crowdforms)
        audit = {}
        audit_log(Actions.USER_FORMLIST_REQUESTED, request.user, formlist_user,
                  _("Requested forms list."), audit, request)
    response = render_to_response("xformsList.xml", {
        'host': request.build_absolute_uri().replace(
            request.get_full_path(), ''),
        'xforms': xforms
    }, mimetype="text/xml; charset=utf-8")
    response['X-OpenRosa-Version'] = '1.0'
    tz = pytz.timezone(settings.TIME_ZONE)
    dt = datetime.now(tz).strftime('%a, %d %b %Y %H:%M:%S %Z')
    response['Date'] = dt
    return response
def formList ( request , username ) : if username . lower ( ) == 'crowdforms' : xforms = XForm . objects . filter ( is_crowd_form = True ) . exclude ( user__username = username ) else : formlist_user = get_object_or_404 ( User , username = username ) profile , created = UserProfile . objects . get_or_create ( user = formlist_user ) if profile . require_auth : authenticator = HttpDigestAuthenticator ( ) if not authenticator . authenticate ( request ) : return authenticator . build_challenge_response ( ) if formlist_user . username != request . user . username or not request . user . is_active : return HttpResponseNotAuthorized ( ) xforms = XForm . objects . filter ( downloadable = True , user__username = username ) crowdforms = XForm . objects . filter ( metadata__data_type = MetaData . CROWDFORM_USERS , metadata__data_value = username ) xforms = chain ( xforms , crowdforms ) audit = { } audit_log ( Actions . USER_FORMLIST_REQUESTED , request . user , formlist_user , _ ( "Requested forms list." ) , audit , request ) response = render_to_response ( "xformsList.xml" , { 'host' : request . build_absolute_uri ( ) . replace ( request . get_full_path ( ) , '' ) , 'xforms' : xforms } , mimetype = "text/xml; charset=utf-8" ) response [ 'X-OpenRosa-Version' ] = '1.0' tz = pytz . timezone ( settings . TIME_ZONE ) dt = datetime . now ( tz ) . strftime ( '%a, %d %b %Y %H:%M:%S %Z' ) response [ 'Date' ] = dt return response
This is where ODK Collect gets its download list.
This is where ODK Collect gets its download list .
"""
    This is where ODK Collect gets its download list.
    """ # unauthorized if user in auth request does not match user in path # unauthorized if user not active # retrieve crowd_forms for this user #'urls': urls,
request
username