from django.core.exceptions import ObjectDoesNotExist
try:
disabledusers.objects.get(sAMAccountName='liu')
except ObjectDoesNotExist:
print 'a'

except modelname.DoesNotExist:

Django抛错不存在(DoesNotExist)的更多相关文章

  1. 【原创】cs+html+js+css模式(七): 顺序执行与并发执行问题,IIS7及其以上版本的抛错问题解决

          在进行开发的过程中,针对于这种模式,我们继承的IRequiresSessionState,这种对于我们的同一个IIS的执行中是顺序执行即一个ajax请求处理完成后,才能执行下一个ajax, ...

  2. 安装Django时报错'module' object has no attribute 'lru_cache'

    使用pip方法安装Django时报错'module' object has no attribute 'lru_cache' 解决办法如下 命令行输入命令sudo pip install Django ...

  3. Django报错:OSError: raw write() returned invalid length 4 (should have been between 0 and 2)

    在使用Django时Django报错:Django报错:OSError: raw write() returned invalid length 4 (should have been between ...

  4. Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set.

    Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and ...

  5. 116.C语言异常抛错

    #include <stdlib.h> #include <stdio.h> #include <setjmp.h> //异常抛错检测 jmp_buf buf1; ...

  6. django 报错Reverse for 'detail' with keyword arguments '{'pk': '2'}' not found. 1 pattern(s) tried: ['$post/(?P<pk>[0-9]+)/$']

    Django报错:Reverse for 'detail' with keyword arguments '{'pk': '2'}' not found. 1 pattern(s) tried: [' ...

  7. Django 报错 Reverse for 'content' not found. 'content' is not a valid view function or pattern name.

    Django 报错 Reverse for 'content' not found. 'content' is not a valid view function or pattern name. 我 ...

  8. django 报错处理汇总

    运行 manage.py task时 ,makemigrations抛出以下错误, django.db.utils.OperationalError: (1045, "Access deni ...

  9. ubuntu pip 安装django报错解决

    系统版本 ubuntu  Kylin 16.04 LTS       安装pip3 安装 Django 总是提示time out,无法安装. 逛了好多论坛终于遭到了解决办法,分享保存: sudo pi ...

随机推荐

  1. PoEdu - C++阶段班【Po学校】- 第1课

    1 C++开讲 C ++  伟大的编程语言:能提高程序运行效率,节约更多的资源,"正确的使用C++,能够抑制全球变暖问题". 2 C++能力雷达图 通过 1效率 2灵活度 3 抽象 ...

  2. nginx 报错 upstream timed out (110: Connection timed out)解决方案

    nginx 作PHP的web接口服务器. 在线上发现时不时经常崩溃.504,导致接口访问无响应回复. 查看日志: [error] 11618#0: *324911 upstream timed out ...

  3. linux系统中scp命令的用法(Permission denied排错二例)

    原文链接: 这里需要注意,当往远程主机拷文件时,必须当前用户对远程主机的对应目录具有写权限 http://www.360doc.com/content/13/0929/13/6496277_31784 ...

  4. Add sharing to your app via UIActivityViewController

    http://www.codingexplorer.com/add-sharing-to-your-app-via-uiactivityviewcontroller/ April 4, 2014 Ev ...

  5. __slots__ 属性绑定

    s = Student() # 创建新的实例 s.name = 'Michael' # 绑定属性'name' s.age = 25 # 绑定属性'age' s.score = 99 # 绑定属性'sc ...

  6. public <T> void show(T t),void前面的泛型T是什么作用

    public <T>这个T是个修饰符的功能,表示是个泛型方法,就像有static修饰的方法是个静态方法一样. <T> 不是返回值,表示传入参数有泛型 public static ...

  7. andorid lint

    (一)Lint简介 Android SDK提供了一个代码扫描工具,称为lint.可以帮助您轻松地识别并纠正问题与结构质量的代码,不必执行应用程序或编写任何测试用例.每个问题检测到该工具报告的一个描述消 ...

  8. opengles2.0之图元装配和光栅化

    光栅化的过程就是把三维世界中的物体转换成屏幕上像素的过程. glGetfloatv();    --------v表示的是数组 gles2.0里面有两种绘图命令.glDrawArrays和glDraw ...

  9. my sql

    如果改了上面的4个配置文件,要让其立即生效,可以使用如下方法 source .bash_profile . .bash_profile 基于Apache+php+mysql的许愿墙网站的搭建 方案一: ...

  10. Fix network adapter not present problem in cloned CentOS

    (You can find a lot of articles on this from the internet. I just put it here for my own record.) It ...