调试django、pprint模型的工具

djangodbu的Python项目详细描述


调试django的工具

摘要

  • 宿舍:漂亮的打印模型、查询集等。
  • 搜索字典和列表中的字符串。
  • ago:生成日期时间。

宿舍-调试django orm

带有语法突出显示、列布局和 速记。

dorm可以处理:-模型实例+属性着色+分组+ 属性值+并行列打印-查询集+全部打印 QuerySet+中的行打印选定的值(以values=[]方式)或 “callable”+paginate中的值,带skip to page-query+语法 突出显示-list/dict/tuple到pprint

要求

  • Python2
  • Django
  • sqlparse

安装

$ pip install djangodbu

用法

启动django shell plus:python manage.py shell_plus

>>>fromdjangodbuimportdorm>>>dorm(MyModel.objects.get(id=123))
         instancemethod serializable_value
         instancemethod set_password
         instancemethod set_unusable_password
         instancemethod unique_error_message
         instancemethod validate_unique
                unicode USERNAME_FIELD: username
                unicode email: some.one@example.org
                unicode first_name: Some
                unicode last_name: One
                unicode password: pbkdf2_sha256$20000$
                unicode username: someone
                   list REQUIRED_FIELDS: 1
                   long id: 357
                   long pk: 357
so.mo.na.AccountingUser accountinguser: 651 > 'Some One'
         RelatedManager additionalemail_set: 1
         RelatedManager callback_set: 0
         RelatedManager campaigncode_set: 0
         RelatedManager grouplog: 142
     ManyRelatedManager groups: 0
         RelatedManager log: 379
         RelatedManager logevent_set: 89
         RelatedManager message_set: 11
       lo.pa.to.Payment payment: 510 > 'Bob & Uncle'
         RelatedManager settings_set: 1
         RelatedManager social_auth: 0
     ManyRelatedManager user_permissions: 0
         RelatedManager worker_set: 1
               NoneType activationcode
               NoneType auth_token
               NoneType employee
                   bool is_active: True
                   bool is_superuser: False
      datetime.datetime date_joined: 2016-05-01 08:13:16+00:00
      datetime.datetime last_login: 2016-06-20 07:48:51+00:00
                   type DoesNotExist: DoesNotExist
               classobj Meta: Meta
                   type MultipleObjectsReturned: MultipleObjectsReturned

打印查询集:

>>>dorm(MyModel.objects.all())1:userA2:userB4:userD20:userY...

为queryset选择值:

>>>dorm(User.objects.all(),v='first_name, email')id:firstnameemail------------------------------------------------1:abcduserA@example.org2:efghijuserB@example.org4:kluserD@example.org20:MnopqrstuserY@example.org...

打印查询:

>>>dorm(User.objects.filter(email__isnull=False).exclude(first_name='kl').query)
SELECTauth_user.id,auth_user.password,auth_user.username,auth_user.first_name,auth_user.last_name,auth_user.emailFROMauth_userWHERE(auth_user.emailISNOTNULLANDNOT(auth_user.first_name=kl))

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使用ApachePOI将excel文件导入postgreSQL表   java多线程从iText pdf提取文本   winapi Java和SetWindowDisplayAffinity   eclipse juno的java Websphere 6.1插件   java MPAndroidChart:为Y轴提供一些偏移   java中作为参数传递枚举类型的继承   java Gui jframe的工作原理与netbeans不同   使用Bouncy Castle和PDFBox在Java中验证PDF签名   优化缩小Java代码   java无法在安卓中从Firebase取回子数据   返回的java方法?我应该什么时候用?   java错误处理已完成,退出代码为1。与穿过阵列的for循环有关   多线程Java volatile是否阻止缓存或强制执行写缓存?   java Multi-collectItems如何提前终止并返回已收集的项目   java为什么不在服务(请求,响应)中直接调用processRequest(请求,响应)?   java如何从字符串生成int数组?   打印获取用户输入的值并在其他预选文本中显示。JAVA   未显示java DynamicAsper UTF8字符   java Eclipse RCP:不启动应用程序的命令行参数