问题描述
我确定这是一个常见问题解答,但 Google 退回的前 12 件商品中没有这个问题。
我有一个 def account_view(request,*args,**kwargs):
"""
- Logic here is kind of tricky
is_self
is_friend
-1: NO_REQUEST_SENT
0: THEM_SENT_TO_YOU
1: YOU_SENT_TO_THEM
"""
context = {}
user_id = kwargs.get("user_id")
try:
account = User.objects.get(pk=user_id)
except:
return HttpResponse("Something went wrong.")
if account:
context['id'] = account.id
context['username'] = account.username
context['bio'] = account.bio
context['get_full_name'] = account.get_full_name
context['email'] = account.email
context['profile_pic'] = account.profile_pic.url
context['cover_image'] = account.cover_image.url
context['city'] = account.city
context['country'] = account.country
context['gender'] = account.gender
context['hide_email'] = account.hide_email
try:
post_list = Post.objects.filter(user_name=account)
except Post.DoesNotExist:
post_list = Post(user_name=account)
save.post_list()
posts = post_list.posts.all()
context['posts'] = posts
try:
friend_list = FriendList.objects.get(user=account)
except FriendList.DoesNotExist:
friend_list = FriendList(user=account)
friend_list.save()
friends = friend_list.friends.all()
context['friends'] = friends
,其中第一项是公寓号,第二项是租户姓名。我流行,然后循环结果并打印,我得到类似......
SortedDictionary(of String,String)
我完全不知道这个排序要做什么,但无论如何,我需要这个列表是 A-1、A-2、A-10、A-12(等等)
我们被禁止使用 LINQ(高于我的工资等级),那么是否有一些简单的方法可以将排序更改为符合预期?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)