本文整理汇总了Python中voter.models.voter_has_authority函数的典型用法代码示例。如果您正苦于以下问题:Python voter_has_authority函数的具体用法?Python voter_has_authority怎么用?Python voter_has_authority使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了voter_has_authority函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: office_list_view
def office_list_view(request):
authority_required = {'verified_volunteer'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
messages_on_stage = get_messages(request)
google_civic_election_id = convert_to_int(request.GET.get('google_civic_election_id', 0))
office_list_manager = ContestOfficeListManager()
updated_office_list = []
results = office_list_manager.retrieve_all_offices_for_upcoming_election(google_civic_election_id, True)
if results['office_list_found']:
office_list = results['office_list_objects']
for office in office_list:
office.candidate_count = fetch_candidate_count_for_office(office.id)
updated_office_list.append(office)
election_list = Election.objects.order_by('-election_day_text')
template_values = {
'messages_on_stage': messages_on_stage,
'office_list': updated_office_list,
'election_list': election_list,
'google_civic_election_id': google_civic_election_id,
}
return render(request, 'office/office_list.html', template_values)
开发者ID:trinile,项目名称:WeVoteServer,代码行数:26,代码来源:views_admin.py
示例2: quick_info_summary_view
def quick_info_summary_view(request, quick_info_id): # TODO to be updated
authority_required = {'verified_volunteer'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
messages_on_stage = get_messages(request)
quick_info_id = convert_to_int(quick_info_id)
quick_info_on_stage_found = False
quick_info_on_stage = QuickInfo()
try:
quick_info_on_stage = QuickInfo.objects.get(id=quick_info_id)
quick_info_on_stage_found = True
except QuickInfo.MultipleObjectsReturned as e:
handle_record_found_more_than_one_exception(e, logger=logger)
except QuickInfo.DoesNotExist:
# This is fine, create new
pass
if quick_info_on_stage_found:
template_values = {
'messages_on_stage': messages_on_stage,
'quick_info': quick_info_on_stage,
}
else:
template_values = {
'messages_on_stage': messages_on_stage,
}
return render(request, 'quick_info/quick_info_summary.html', template_values)
开发者ID:nf071590,项目名称:WeVoteServer,代码行数:28,代码来源:views_admin.py
示例3: office_edit_view
def office_edit_view(request, office_id):
authority_required = {'verified_volunteer'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
messages_on_stage = get_messages(request)
office_id = convert_to_int(office_id)
google_civic_election_id = request.GET.get('google_civic_election_id', 0)
office_on_stage_found = False
try:
office_on_stage = ContestOffice.objects.get(id=office_id)
office_on_stage_found = True
except ContestOffice.MultipleObjectsReturned as e:
handle_record_found_more_than_one_exception(e, logger=logger)
except ContestOffice.DoesNotExist:
# This is fine, create new
pass
if office_on_stage_found:
template_values = {
'messages_on_stage': messages_on_stage,
'office': office_on_stage,
'google_civic_election_id': google_civic_election_id,
}
else:
template_values = {
'messages_on_stage': messages_on_stage,
'google_civic_election_id': google_civic_election_id,
}
return render(request, 'office/office_edit.html', template_values)
开发者ID:trinile,项目名称:WeVoteServer,代码行数:31,代码来源:views_admin.py
示例4: sync_data_with_master_servers_view
def sync_data_with_master_servers_view(request):
authority_required = {'admin'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
google_civic_election_id = request.GET.get('google_civic_election_id', '')
state_code = request.GET.get('state_code', '')
election_list = Election.objects.order_by('-election_day_text')
state_list = STATE_CODE_MAP
sorted_state_list = sorted(state_list.items())
template_values = {
'election_list': election_list,
'google_civic_election_id': google_civic_election_id,
'state_list': sorted_state_list,
'state_code': state_code,
'ballot_items_sync_url': BALLOT_ITEMS_SYNC_URL,
'ballot_returned_sync_url': BALLOT_RETURNED_SYNC_URL,
'candidates_sync_url': CANDIDATES_SYNC_URL,
'elections_sync_url': ELECTIONS_SYNC_URL,
'measures_sync_url': MEASURES_SYNC_URL,
'offices_sync_url': OFFICES_SYNC_URL,
'organizations_sync_url': ORGANIZATIONS_SYNC_URL,
'polling_locations_sync_url': POLLING_LOCATIONS_SYNC_URL,
'positions_sync_url': POSITIONS_SYNC_URL,
'voter_guides_sync_url': VOTER_GUIDES_SYNC_URL,
}
response = render(request, 'admin_tools/sync_data_with_master_dashboard.html', template_values)
return response
开发者ID:trinile,项目名称:WeVoteServer,代码行数:33,代码来源:views.py
示例5: retrieve_twitter_data_for_all_organizations_view
def retrieve_twitter_data_for_all_organizations_view(request):
authority_required = {'admin'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
organization_state_code = request.GET.get('organization_state', '')
google_civic_election_id = request.GET.get('google_civic_election_id', 0)
first_retrieve_only = request.GET.get('first_retrieve_only', True)
results = retrieve_twitter_data_for_all_organizations(state_code=organization_state_code,
google_civic_election_id=google_civic_election_id,
first_retrieve_only=first_retrieve_only)
if not results['success']:
messages.add_message(request, messages.INFO, results['status'])
else:
number_of_twitter_accounts_queried = results['number_of_twitter_accounts_queried']
number_of_organizations_updated = results['number_of_organizations_updated']
messages.add_message(request, messages.INFO,
"Twitter accounts queried: {number_of_twitter_accounts_queried}, "
"Organizations updated: {number_of_organizations_updated}".format(
number_of_twitter_accounts_queried=number_of_twitter_accounts_queried,
number_of_organizations_updated=number_of_organizations_updated))
return HttpResponseRedirect(reverse('organization:organization_list', args=()) +
'?organization_state=' + organization_state_code)
开发者ID:josephevans,项目名称:WeVoteServer,代码行数:26,代码来源:views_admin.py
示例6: quick_info_master_new_view
def quick_info_master_new_view(request):
authority_required = {'verified_volunteer'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
# If the voter tried to submit an entry, and it didn't save, capture the changed values for display
kind_of_ballot_item = request.POST.get('kind_of_ballot_item', "")
language = request.POST.get('language', ENGLISH)
info_text = request.POST.get('info_text', "")
info_html = request.POST.get('info_html', "")
master_entry_name = request.POST.get('master_entry_name', "")
more_info_credit = request.POST.get('more_info_credit', "")
more_info_url = request.POST.get('more_info_url', "")
quick_info_master = QuickInfoMaster()
quick_info_master.kind_of_ballot_item = kind_of_ballot_item
quick_info_master.language = language
quick_info_master.master_entry_name = master_entry_name
quick_info_master.more_info_credit = more_info_credit
quick_info_master.more_info_url = more_info_url
quick_info_master.info_text = info_text
quick_info_master.info_html = info_html
messages_on_stage = get_messages(request)
template_values = {
'messages_on_stage': messages_on_stage,
'language_choices': LANGUAGE_CHOICES,
'ballot_item_choices': KIND_OF_BALLOT_ITEM_CHOICES,
'quick_info_master': quick_info_master,
}
return render(request, 'quick_info/quick_info_master_edit.html', template_values)
开发者ID:nf071590,项目名称:WeVoteServer,代码行数:32,代码来源:views_admin.py
示例7: organization_edit_existing_position_form_view
def organization_edit_existing_position_form_view(request, organization_id, position_id):
"""
In edit, you can only change your stance and comments, not who or what the position is about
:param request:
:param organization_id:
:param position_id:
:return:
"""
authority_required = {'verified_volunteer'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
messages_on_stage = get_messages(request)
organization_id = convert_to_int(organization_id)
position_id = convert_to_int(position_id)
organization_on_stage_found = False
try:
organization_on_stage = Organization.objects.get(id=organization_id)
organization_on_stage_found = True
except Organization.MultipleObjectsReturned as e:
handle_record_found_more_than_one_exception(e, logger=logger)
except Organization.DoesNotExist:
# This is fine, create new
pass
if not organization_on_stage_found:
messages.add_message(request, messages.INFO,
'Could not find organization when trying to edit a position.')
return HttpResponseRedirect(reverse('organization:organization_position_list', args=([organization_id])))
# Get the existing position
organization_position_on_stage = PositionEntered()
organization_position_on_stage_found = False
position_entered_manager = PositionEnteredManager()
results = position_entered_manager.retrieve_position_from_id(position_id)
if results['position_found']:
organization_position_on_stage_found = True
organization_position_on_stage = results['position']
if not organization_position_on_stage_found:
messages.add_message(request, messages.INFO,
'Could not find organization position when trying to edit.')
return HttpResponseRedirect(reverse('organization:organization_position_list', args=([organization_id])))
# Note: We have access to the candidate campaign through organization_position_on_stage.candidate_campaign
election_list = Election.objects.all()
if organization_position_on_stage_found:
template_values = {
'is_in_edit_mode': True,
'messages_on_stage': messages_on_stage,
'organization': organization_on_stage,
'organization_position': organization_position_on_stage,
'possible_stances_list': ORGANIZATION_STANCE_CHOICES,
'stance_selected': organization_position_on_stage.stance,
'election_list': election_list,
}
return render(request, 'organization/organization_position_edit.html', template_values)
开发者ID:eternal44,项目名称:WeVoteServer,代码行数:60,代码来源:views_admin.py
示例8: voter_summary_view
def voter_summary_view(request, voter_id):
authority_required = {'admin'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
messages_on_stage = get_messages(request)
voter_id = convert_to_int(voter_id)
voter_on_stage_found = False
try:
voter_on_stage = Voter.objects.get(id=voter_id)
voter_on_stage_found = True
except Voter.MultipleObjectsReturned as e:
handle_record_found_more_than_one_exception(e, logger=logger)
except Voter.DoesNotExist:
# This is fine, create new
pass
if voter_on_stage_found:
template_values = {
'messages_on_stage': messages_on_stage,
'voter': voter_on_stage,
}
else:
template_values = {
'messages_on_stage': messages_on_stage,
}
return render(request, 'voter/voter_summary.html', template_values)
开发者ID:sammyds,项目名称:WeVoteServer,代码行数:27,代码来源:views_admin.py
示例9: politician_tag_new_view
def politician_tag_new_view(request, politician_id):
"""
Form to add a new link tying a politician to twitter tags
:param request:
:return:
"""
authority_required = {'verified_volunteer'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
messages_on_stage = get_messages(request)
# for message in messages_on_stage:
# if message.level is ERROR:
politician_on_stage = get_object_or_404(Politician, id=politician_id)
try:
tag_link_list = politician_on_stage.tag_link.all()
except PoliticianTagLink.DoesNotExist:
tag_link_list = None
template_values = {
'politician_on_stage': politician_on_stage,
'tag_link_list': tag_link_list,
'messages_on_stage': messages_on_stage,
}
return render(request, 'politician/politician_tag_new.html', template_values)
开发者ID:eternal44,项目名称:WeVoteServer,代码行数:26,代码来源:views.py
示例10: position_list_view
def position_list_view(request):
authority_required = {'verified_volunteer'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
messages_on_stage = get_messages(request)
google_civic_election_id = convert_to_int(request.GET.get('google_civic_election_id', 0))
position_list_manager = PositionListManager()
if positive_value_exists(google_civic_election_id):
public_only = True
position_list = position_list_manager.retrieve_all_positions_for_election(google_civic_election_id, ANY_STANCE,
public_only)
else:
position_list = PositionEntered.objects.order_by('position_id')[:500] # This order_by is temp
election_list = Election.objects.order_by('-election_day_text')
template_values = {
'messages_on_stage': messages_on_stage,
'position_list': position_list,
'election_list': election_list,
'google_civic_election_id': google_civic_election_id,
}
return render(request, 'position/position_list.html', template_values)
开发者ID:eternal44,项目名称:WeVoteServer,代码行数:26,代码来源:views_admin.py
示例11: organization_new_view
def organization_new_view(request):
authority_required = {'verified_volunteer'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
# A positive value in google_civic_election_id means we want to create a voter guide for this org for this election
google_civic_election_id = request.GET.get('google_civic_election_id', 0)
election_manager = ElectionManager()
upcoming_election_list = []
results = election_manager.retrieve_upcoming_elections()
if results['success']:
upcoming_election_list = results['election_list']
state_list = STATE_CODE_MAP
sorted_state_list = sorted(state_list.items())
messages_on_stage = get_messages(request)
template_values = {
'messages_on_stage': messages_on_stage,
'upcoming_election_list': upcoming_election_list,
'google_civic_election_id': google_civic_election_id,
'state_list': sorted_state_list,
}
return render(request, 'organization/organization_edit.html', template_values)
开发者ID:trinile,项目名称:WeVoteServer,代码行数:25,代码来源:views_admin.py
示例12: retrieve_positions_from_vote_smart_for_election_view
def retrieve_positions_from_vote_smart_for_election_view(request):
authority_required = {'admin'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
google_civic_election_id = request.GET.get('google_civic_election_id', 0)
try:
candidate_list = CandidateCampaign.objects.all()
if positive_value_exists(google_civic_election_id):
candidate_list = candidate_list.filter(google_civic_election_id=google_civic_election_id)
candidate_list = candidate_list.order_by('candidate_name')[:500]
except CandidateCampaign.DoesNotExist:
messages.add_message(request, messages.INFO, "Could not find any candidates.")
pass
# Do a first pass through where we get positions for candidates for whom we already have an id
for we_vote_candidate in candidate_list:
if we_vote_candidate.vote_smart_id:
retrieve_vote_smart_ratings_by_candidate_into_local_db(we_vote_candidate.vote_smart_id)
transfer_vote_smart_ratings_to_positions_for_candidate(we_vote_candidate.id)
# Then we cycle through again, and if we find a Vote Smart id, we get positions for that candidate
for we_vote_candidate in candidate_list:
if not we_vote_candidate.vote_smart_id:
force_retrieve = False
results = retrieve_and_match_candidate_from_vote_smart(we_vote_candidate, force_retrieve)
if results['success'] and results['we_vote_candidate_id']:
we_vote_candidate = results['we_vote_candidate']
if we_vote_candidate.vote_smart_id:
retrieve_vote_smart_ratings_by_candidate_into_local_db(we_vote_candidate.vote_smart_id)
transfer_vote_smart_ratings_to_positions_for_candidate(we_vote_candidate.id)
return HttpResponseRedirect(reverse('position:position_list', args=()) +
"?google_civic_election_id=" + google_civic_election_id)
开发者ID:nf071590,项目名称:WeVoteServer,代码行数:35,代码来源:views_admin.py
示例13: voter_guide_list_view
def voter_guide_list_view(request):
authority_required = {'verified_volunteer'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
google_civic_election_id = convert_to_int(request.GET.get('google_civic_election_id', 0))
voter_guide_list = []
voter_guide_list_object = VoterGuideListManager()
if positive_value_exists(google_civic_election_id):
results = voter_guide_list_object.retrieve_voter_guides_for_election(
google_civic_election_id=google_civic_election_id)
if results['success']:
voter_guide_list = results['voter_guide_list']
else:
order_by = "google_civic_election_id"
results = voter_guide_list_object.retrieve_all_voter_guides(order_by)
if results['success']:
voter_guide_list = results['voter_guide_list']
election_list = Election.objects.order_by('-election_day_text')
messages_on_stage = get_messages(request)
template_values = {
'election_list': election_list,
'google_civic_election_id': google_civic_election_id,
'messages_on_stage': messages_on_stage,
'voter_guide_list': voter_guide_list,
}
return render(request, 'voter_guide/voter_guide_list.html', template_values)
开发者ID:trinile,项目名称:WeVoteServer,代码行数:32,代码来源:views_admin.py
示例14: polling_location_summary_by_we_vote_id_view
def polling_location_summary_by_we_vote_id_view(request, polling_location_we_vote_id):
authority_required = {'verified_volunteer'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
messages_on_stage = get_messages(request)
polling_location_on_stage_found = False
polling_location_on_stage = PollingLocation()
try:
polling_location_on_stage = PollingLocation.objects.get(we_vote_id=polling_location_we_vote_id)
polling_location_on_stage_found = True
except PollingLocation.MultipleObjectsReturned as e:
handle_record_found_more_than_one_exception(e, logger=logger)
except PollingLocation.DoesNotExist:
# This is fine, create new
pass
if polling_location_on_stage_found:
template_values = {
'messages_on_stage': messages_on_stage,
'polling_location': polling_location_on_stage,
}
else:
template_values = {
'messages_on_stage': messages_on_stage,
}
return render(request, 'polling_location/polling_location_summary.html', template_values)
开发者ID:eternal44,项目名称:WeVoteServer,代码行数:27,代码来源:views_admin.py
示例15: position_edit_view
def position_edit_view(request, position_id):
authority_required = {'verified_volunteer'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
messages_on_stage = get_messages(request)
position_id = convert_to_int(position_id)
position_on_stage_found = False
try:
position_on_stage = CandidateCampaign.objects.get(id=position_id)
position_on_stage_found = True
except CandidateCampaign.MultipleObjectsReturned as e:
handle_record_found_more_than_one_exception(e, logger=logger)
except CandidateCampaign.DoesNotExist:
# This is fine, create new
pass
if position_on_stage_found:
template_values = {
'messages_on_stage': messages_on_stage,
'position': position_on_stage,
}
else:
template_values = {
'messages_on_stage': messages_on_stage,
}
return render(request, 'position/position_edit.html', template_values)
开发者ID:sammyds,项目名称:WeVoteServer,代码行数:27,代码来源:views_admin.py
示例16: measure_list_view
def measure_list_view(request):
authority_required = {"verified_volunteer"} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
messages_on_stage = get_messages(request)
google_civic_election_id = request.GET.get("google_civic_election_id", 0)
try:
measure_list = ContestMeasure.objects.order_by("measure_title")
if positive_value_exists(google_civic_election_id):
measure_list = measure_list.filter(google_civic_election_id=google_civic_election_id)
except ContestMeasure.DoesNotExist:
# This is fine
measure_list = ContestMeasure()
pass
election_list = Election.objects.order_by("-election_day_text")
template_values = {
"messages_on_stage": messages_on_stage,
"measure_list": measure_list,
"election_list": election_list,
"google_civic_election_id": google_civic_election_id,
}
return render(request, "measure/measure_list.html", template_values)
开发者ID:nf071590,项目名称:WeVoteServer,代码行数:26,代码来源:views_admin.py
示例17: measure_summary_view
def measure_summary_view(request, measure_id):
authority_required = {'verified_volunteer'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
messages_on_stage = get_messages(request)
measure_id = convert_to_int(measure_id)
measure_on_stage_found = False
measure_on_stage = ContestMeasure()
google_civic_election_id = convert_to_int(request.GET.get('google_civic_election_id', 0))
try:
measure_on_stage = ContestMeasure.objects.get(id=measure_id)
measure_on_stage_found = True
except ContestMeasure.MultipleObjectsReturned as e:
handle_record_found_more_than_one_exception(e, logger=logger)
except ContestMeasure.DoesNotExist:
# This is fine, create new
pass
election_list = Election.objects.order_by('-election_day_text')
if measure_on_stage_found:
template_values = {
'messages_on_stage': messages_on_stage,
'measure': measure_on_stage,
'election_list': election_list,
'google_civic_election_id': google_civic_election_id,
}
else:
template_values = {
'messages_on_stage': messages_on_stage,
}
return render(request, 'measure/measure_summary.html', template_values)
开发者ID:eternal44,项目名称:WeVoteServer,代码行数:33,代码来源:views_admin.py
示例18: vote_smart_rating_list_view
def vote_smart_rating_list_view(request):
authority_required = {'verified_volunteer'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
messages_on_stage = get_messages(request)
rating_list = []
rating_list_found = False
try:
rating_list = VoteSmartRating.objects.order_by('-timeSpan')[:1000] # Descending order, and limited to 1000
if len(rating_list):
rating_list_found = True
except VotesmartApiError as error_instance:
# Catch the error message coming back from Vote Smart and pass it in the status
error_message = error_instance.args
status = "EXCEPTION_RAISED: {error_message}".format(error_message=error_message)
print_to_log(logger=logger, exception_message_optional=status)
# election_list = Election.objects.order_by('-election_day_text')
if rating_list_found:
template_values = {
'messages_on_stage': messages_on_stage,
'rating_list': rating_list,
# 'election_list': election_list,
# 'google_civic_election_id': google_civic_election_id,
}
else:
template_values = {
'messages_on_stage': messages_on_stage,
# 'election_list': election_list,
# 'google_civic_election_id': google_civic_election_id,
}
return render(request, 'import_export_vote_smart/rating_list.html', template_values)
开发者ID:josephevans,项目名称:WeVoteServer,代码行数:34,代码来源:views_admin.py
示例19: import_group_ratings_view
def import_group_ratings_view(request):
authority_required = {'admin'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
# state_code = request.GET.get('state_code', 'NA') # Default to national
# category_id = request.GET.get('category_id', 0)
# Retrieve each group so we can request the ratings for each group
get_sig_group_count = 0
get_sig_error_message_count = 0
special_interest_group_list = VoteSmartSpecialInterestGroup.objects.order_by('name')
for one_group in special_interest_group_list:
special_interest_group_id = one_group.sigId
one_group_results = retrieve_vote_smart_ratings_by_group_into_local_db(special_interest_group_id)
if not one_group_results['success']:
print_to_log(logger=logger, exception_message_optional=one_group_results['status'])
get_sig_error_message_count += 1
else:
get_sig_group_count += 1
messages.add_message(request, messages.INFO, "Ratings from {get_sig_group_count} "
"Special Interest Groups retrieved. "
"(errors: {get_sig_error_message_count})"
"".format(get_sig_group_count=get_sig_group_count,
get_sig_error_message_count=get_sig_error_message_count))
return HttpResponseRedirect(reverse('import_export_vote_smart:vote_smart_rating_list', args=()))
开发者ID:josephevans,项目名称:WeVoteServer,代码行数:29,代码来源:views_admin.py
示例20: import_photo_view
def import_photo_view(request):
authority_required = {'admin'} # admin, verified_volunteer
if not voter_has_authority(request, authority_required):
return redirect_to_sign_in_page(request, authority_required)
# NOTE: This view is for testing purposes. For the operational "Import Vote Smart Images" view, see:
# "candidate_retrieve_photos_view" in candidate/views_admin.py
last_name = "Trump"
results = retrieve_vote_smart_candidates_into_local_db(last_name)
if not results['success']:
messages.add_message(request, messages.INFO, results['status'])
else:
messages.add_message(request, messages.INFO, "Photo retrieved.")
# Now we can go on to make sure we have the right VoteSmartCandidate
vote_smart_candidate_id = 15723
# ...and then retrieve the photo
results = retrieve_vote_smart_candidate_bio_into_local_db(vote_smart_candidate_id)
last_name = "Pelosi"
results = retrieve_vote_smart_officials_into_local_db(last_name)
messages_on_stage = get_messages(request)
template_values = {
'messages_on_stage': messages_on_stage,
}
return render(request, 'import_export_vote_smart/vote_smart_import.html', template_values)
开发者ID:josephevans,项目名称:WeVoteServer,代码行数:28,代码来源:views_admin.py
注:本文中的voter.models.voter_has_authority函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论