调试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 IntelliJ找不到依赖项选项卡   java向字符串数组string[]添加元素并在Junit中测试结果   如何在eclipse中获取活动java项目的名称   如何使用java在mysql中插入时间   java ArrayList更新了插入一行,但Jtable仍然没有刷新   如何在JavaSwing中命名坐标(点)   java Matcher/模式不打印   java错误地设置了arraylist   使用UsernamePasswordCredential提供程序的java列表Azure AD   java在HTTP请求中设置UTC时间   未加载事件:jquery完整日历Java集成   java Maven插件依赖项无法从内部repo解析依赖项   Maven更新重置Java版本   java如何向中添加图片。带有Apache POI XWPF的docx,但不指定其大小   Java最大函数递归