解决方法一:重写构造方法(推荐) 解决方法二:利用Django自带的类方法 对于ModelForm:会帮我们判断model中的字段: 如果是FK:ModelChoiceField 如果是M2M:ModelMultipleChoiceField ...
分类:
其他好文 时间:
2017-12-22 00:38:37
阅读次数:
111
import collections from random import choice card = collections.namedtuple('Card',['rank','suit']) #构建一个命名元组 class FrenchDeck: ranks = [str(n) for n i... ...
分类:
其他好文 时间:
2017-12-21 20:06:41
阅读次数:
142
iOS 获取当前顶层的ViewController #pragma mark - topVC - (UIViewController *)theTopviewControler { UIViewController *resultVC; resultVC = [self _topViewContro ...
分类:
移动开发 时间:
2017-12-21 19:40:13
阅读次数:
154
1 class Foo: 2 def __init__(self,name): 3 self.name = name 4 def tell(self): 5 print("名字是%s"%self.name) 6 @classmethod #绑定到类的方法,类在使用时会将类本身当作参数传给类方法的第一 ...
分类:
其他好文 时间:
2017-12-21 18:16:38
阅读次数:
126
IGeometry pUnionGeo = null; var bFirst = true; foreach (IGeometry pGeo in pGeometrys) { if (pGeo != null && !pGeo.IsEmpty) { //RepairSelfIntersection( ...
分类:
其他好文 时间:
2017-12-21 17:21:04
阅读次数:
117
class Person(object): """人类""" def __init__(self,name): super(Person,self).__init__() self.name = name self.gun = None #用来保存枪的引用 self.hp = 100 def __s... ...
分类:
编程语言 时间:
2017-12-20 22:06:01
阅读次数:
448
模拟器 链接:https://pan.baidu.com/s/1geMcmND 密码:7iir gns0.8.6的版本好用 思科的这个ios好用: c3660 js2 mz.124 21a.bin ctrl+shit+6 停止命令 探讨bgp几个问题 防止环路: as间 as path as内 水平 ...
分类:
其他好文 时间:
2017-12-20 20:18:36
阅读次数:
317
又没有做出来,知道怎么想的,但是想了半天 思想思路太少了 看了答案 想了很久才出来这么个答案,唉 加油!! 答案就很给力了 动态规划(什么鬼? 没听说过呀) 还有一个低配版的::(这个想到了,可惜啊 当时没想透) 这此知识点:(1)动态分配数组内存的方法 : 和c 没有多大的差别 ...
分类:
其他好文 时间:
2017-12-20 14:02:02
阅读次数:
148
练习地址: http://flexboxfroggy.com/ Welcome to Flexbox Froggy, a game where you help Froggy and friends by writing CSS code! Guide this frog to the lilypa ...
分类:
其他好文 时间:
2017-12-19 19:36:15
阅读次数:
160
UINavigationBar是我们在开发过程中经常要用到的一个控件,下面我会为大家介绍一些常用的用法。 1. 设置导航栏的标题 这个不多说,直接上代码 self.navigationItem.title = @"UINavigationBar使用总结"; 2. 设置导航栏的背景颜色 //通过bar ...
分类:
其他好文 时间:
2017-12-19 12:40:08
阅读次数:
298