随笔分类 - django
摘要:model定义 class Article(models.Model): userid = models.ForeignKey(User, null=True, blank=True, verbose_name='登陆人',on_delete=models.CASCADE) avatar = mod
阅读全文
摘要:https://ordinarycoders.com/blog/article/render-forms-with-django-crispy-forms pip install django-crispy-forms in your Django project add crispy_forms
阅读全文
摘要:1、找到文件\site-packages\mdeditor\templates\markdown.html文件 2、找到<script type="text/javascript">这行 3. 这行及以下所有内容删除,也就是把js这块代码全删除了,把js替换 <script type="text/j
阅读全文
摘要:这个插件已经再tryformset/product中引入了js等。 但尚未实验实现。
阅读全文
摘要:https://docs.djangoproject.com/en/4.2/ref/forms/widgets/ 所有的widget class Item(models.Model): YEAR_CHOICES = ( (10, '10代'), (20, '20代'), (30, '30代'), (
阅读全文
摘要:一、定义model时,使用校验 検証内容バリデーションクラス 正規表現によるチェック RegexValidator 最小文字数 MinLengthValidator 最大文字数 MaxLengthValidator 最小値 MinValueValidator 最大値 MaxValueValidato
阅读全文
摘要:django-allauth 可以邮件电话登录,也可以用百度等第三方账号登录 custom user,邮件登录 https://qiita.com/Kei-Segawa/items/aa38f72fc5409a3517c6 另一个例子 https://qiita.com/t-shirayama/it
阅读全文
摘要:https://qiita.com/skokado/items/a25d64cafa3db791b283
阅读全文
摘要:https://qiita.com/godan09/items/13866970972bf3a1c243 PDFで見積書を出力するにあたって関連ライブラリのメリデメを洗い出してみました。 そのライブラリの中で実装方法とアウトプットを提示し、比較できる状態にしすることが本稿の目的です。 この記事は2つ
阅读全文
摘要:querydict和普通dict区别较大 mutable=True才可以编辑,默认不可修改 >>> from django.http import QueryDict >>> qd = QueryDict('spam=1&egg=2') # get で取得すると文字列が返る >>> qd.get('
阅读全文
摘要:How to handle multiple sites in Django: the problem Consider a set up where the same Django project has a bunch of apps that could be reached from mul
阅读全文
摘要:検証内容バリデーションクラス 正規表現によるチェック RegexValidator 最小文字数 MinLengthValidator 最大文字数 MaxLengthValidator 最小値 MinValueValidator 最大値 MaxValueValidato class Item(mode
阅读全文
摘要:バージョン version % pip list | grep requests #インストールしてない人は pip install requestsを実行 requests 2.28.1 % python -V Python 3.9.6 requestsモジュールができること できることはたくさん
阅读全文
摘要:applicaton/models/user.py import uuid from django.contrib.auth.models import AbstractUser from django.contrib.auth.validators import UnicodeUsernameVa
阅读全文
摘要:以下的例子是不可以的, obj.field obj只能是model instance,字典对象不可以 python dict_data = { 'key1': 0, 'key2': 1, } template {{ dict_data.key1 }} 对策: 编写tag custom_filter
阅读全文
摘要:900 是缓存900秒,sidebar_latest_posts 是缓存表示, 一般用于template的动态菜单,加载时候减少数据库访问量 {% load cache %} {% cache 900 sidebar_latest_posts %} <h3>最新文章</h3> <ul> {% for
阅读全文
摘要:1、view和url传递参数 参数方式一: url.py path('xxx/', MailTemplateList.as_view(), name='MailTemplateList'), path('xxx/<str:id>/', MailTemplateList.as_view(), name
阅读全文
摘要:Python Automation Scripts Examples Use Django And Selenium Django is the most popular web framework in the python world. You can use it to create a we
阅读全文
摘要:https://qiita.com/ANKM0/items/8fb032b6af7e64756d69 类似于这个页面 在考核系统中,我是用的 tamplate tag,关联读取显示的信息 {% if field.name == "beikao_user" %} {{ field }} {{ user
阅读全文
摘要:中文例子和讲解: https://www.cnblogs.com/waltsmith/p/8088099.html https://realpython.com/tutorials/django/ Table of Contents Creating a Django Project Getting
阅读全文

浙公网安备 33010602011771号