def get(self, request, imsi=None):
"""Handles GET requests."""
user_profile = UserProfile.objects.get(user=request.user)
network = user_profile.network
try:
subscriber = Subscriber.objects.get(imsi=imsi,
network=network)
except Subscriber.DoesNotExist:
return HttpResponseBadRequest()
initial_form_data = {
'imsi': subscriber.imsi
}
# Set the response context.
context = {
'networks': get_objects_for_user(request.user, 'view_network', klass=Network),
'user_profile': user_profile,
'subscriber': subscriber,
'send_sms_form': dform.SubscriberSendSMSForm(
initial=initial_form_data)
}
# Render template.
template = get_template('dashboard/subscriber_detail/send_sms.html')
html = template.render(context, request)
return HttpResponse(html)
dashboard.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录