摘要: Celery is a distributed task queue system that can be used with Django to perform asynchronous tasks such as sending emails, processing background job 阅读全文
posted @ 2024-03-07 10:49 花生与酒 阅读(2) 评论(0) 推荐(0) 编辑
摘要: Start a project django-admin startproject registrationForm Project directory registration/settings.py # Application definitionINSTALLED_APPS = [ 'djan 阅读全文
posted @ 2024-03-07 10:38 花生与酒 阅读(4) 评论(0) 推荐(0) 编辑
摘要: select tablename, case when substring(tablename,5,1)= 'f' then 'a' -- (1) when substring(tablename,5,1)= 'p' then 'b' -- (2) else 'c' end as flg -- (3 阅读全文
posted @ 2024-03-04 11:01 花生与酒 阅读(1) 评论(0) 推荐(0) 编辑
摘要: Launching a website can be an exciting but nerve-wracking experience. With so many moving parts in the website development process, it’s easy to overl 阅读全文
posted @ 2024-01-09 14:27 花生与酒 阅读(3) 评论(0) 推荐(0) 编辑
摘要: model定义 class Article(models.Model): userid = models.ForeignKey(User, null=True, blank=True, verbose_name='登陆人',on_delete=models.CASCADE) avatar = mod 阅读全文
posted @ 2023-09-15 10:26 花生与酒 阅读(8) 评论(0) 推荐(0) 编辑
摘要: https://ordinarycoders.com/blog/article/render-forms-with-django-crispy-forms pip install django-crispy-forms in your Django project add crispy_forms  阅读全文
posted @ 2023-09-13 14:19 花生与酒 阅读(20) 评论(0) 推荐(0) 编辑
摘要: https://requests.readthedocs.io/projects/requests-html/en/latest/ 非常好的教程:https://www.jcchouinard.com/web-scraping-with-python-and-requests-html/#Extra 阅读全文
posted @ 2023-09-12 14:30 花生与酒 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 1、找到文件\site-packages\mdeditor\templates\markdown.html文件 2、找到<script type="text/javascript">这行 3. 这行及以下所有内容删除,也就是把js这块代码全删除了,把js替换 <script type="text/j 阅读全文
posted @ 2023-09-12 09:38 花生与酒 阅读(55) 评论(0) 推荐(0) 编辑
摘要: Update View refers to a view (logic) to update a particular instance of a table from the database with some extra details. It is used to update entrie 阅读全文
posted @ 2023-09-06 17:40 花生与酒 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 这个插件已经再tryformset/product中引入了js等。 但尚未实验实现。 阅读全文
posted @ 2023-09-06 11:13 花生与酒 阅读(4) 评论(0) 推荐(0) 编辑
摘要: https://docs.djangoproject.com/en/4.2/ref/forms/widgets/ 所有的widget class Item(models.Model): YEAR_CHOICES = ( (10, '10代'), (20, '20代'), (30, '30代'), ( 阅读全文
posted @ 2023-09-01 16:19 花生与酒 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 一、定义model时,使用校验 検証内容バリデーションクラス 正規表現によるチェック RegexValidator 最小文字数 MinLengthValidator 最大文字数 MaxLengthValidator 最小値 MinValueValidator 最大値 MaxValueValidato 阅读全文
posted @ 2023-09-01 16:17 花生与酒 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 1、托入几个矩形,当1、2级菜单 2.、 菜单全选,右键,转为动态面板,动态面板命名为一级菜单名称 3、系统管理面板,默认是状态1 ,里面有3个按钮, 状态1->改为展开, 再增加一个关闭状态 (1)双击系统管理面板, (2)新增状态 (3)把展开状态的系统管理菜单, 复制到关闭状态里 4、展开状态 阅读全文
posted @ 2023-08-23 12:00 花生与酒 阅读(132) 评论(0) 推荐(0) 编辑
摘要: django-allauth 可以邮件电话登录,也可以用百度等第三方账号登录 custom user,邮件登录 https://qiita.com/Kei-Segawa/items/aa38f72fc5409a3517c6 另一个例子 https://qiita.com/t-shirayama/it 阅读全文
posted @ 2023-07-21 10:23 花生与酒 阅读(18) 评论(0) 推荐(0) 编辑
摘要: https://qiita.com/skokado/items/a25d64cafa3db791b283 阅读全文
posted @ 2023-07-21 09:20 花生与酒 阅读(10) 评论(0) 推荐(0) 编辑
摘要: https://qiita.com/godan09/items/13866970972bf3a1c243 PDFで見積書を出力するにあたって関連ライブラリのメリデメを洗い出してみました。 そのライブラリの中で実装方法とアウトプットを提示し、比較できる状態にしすることが本稿の目的です。 この記事は2つ 阅读全文
posted @ 2023-07-20 17:28 花生与酒 阅读(14) 评论(0) 推荐(0) 编辑
摘要: querydict和普通dict区别较大 mutable=True才可以编辑,默认不可修改 >>> from django.http import QueryDict >>> qd = QueryDict('spam=1&egg=2') # get で取得すると文字列が返る >>> qd.get(' 阅读全文
posted @ 2023-07-20 17:20 花生与酒 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2023-07-20 15:19 花生与酒 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 検証内容バリデーションクラス 正規表現によるチェック RegexValidator 最小文字数 MinLengthValidator 最大文字数 MaxLengthValidator 最小値 MinValueValidator 最大値 MaxValueValidato class Item(mode 阅读全文
posted @ 2023-07-19 10:21 花生与酒 阅读(5) 评论(0) 推荐(0) 编辑
摘要: バージョン version % pip list | grep requests #インストールしてない人は pip install requestsを実行 requests 2.28.1 % python -V Python 3.9.6 requestsモジュールができること できることはたくさん 阅读全文
posted @ 2023-07-19 10:08 花生与酒 阅读(5) 评论(0) 推荐(0) 编辑
摘要: applicaton/models/user.py import uuid from django.contrib.auth.models import AbstractUser from django.contrib.auth.validators import UnicodeUsernameVa 阅读全文
posted @ 2023-07-16 11:17 花生与酒 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 以下的例子是不可以的, obj.field obj只能是model instance,字典对象不可以 python dict_data = { 'key1': 0, 'key2': 1, } template {{ dict_data.key1 }} 对策: 编写tag custom_filter 阅读全文
posted @ 2023-07-16 11:05 花生与酒 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 可以用来做后台任务,可以在django view中调用,当做异步任务 考核系统中要的 threading,用来异步考核结果和考核进度的统计 Python的多线程(threading)与多进程(multiprocessing ) 阅读全文
posted @ 2023-07-16 10:44 花生与酒 阅读(13) 评论(0) 推荐(0) 编辑
摘要: ubuntu django sudo vi django.sh #インストールのコマンドです。 sudo apt install git sudo apt-get install apache2 apache2-dev gdal-bin libgdal-dev sudo apt install li 阅读全文
posted @ 2023-07-14 10:48 花生与酒 阅读(29) 评论(0) 推荐(0) 编辑
摘要: Certbotインストール bash sudo apt install certbot Nginxを停止 bash sudo systemctl stop nginx 👆をしないと、certbotで証明書を発行するときエラーになる HTTPSポート(443ポート)開放 EC2 > セキュリティ > 阅读全文
posted @ 2023-07-14 10:23 花生与酒 阅读(8) 评论(0) 推荐(0) 编辑
摘要: {% for review in reviews %} {% if forloop.first %} <p>{{ review.review }}</p> {% endif %} {% endfor %} {% for value in values %} <p>count: {{ forloop. 阅读全文
posted @ 2023-07-13 17:04 花生与酒 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 加入是 1999/10/12出生 (20230505-19991012)/10000 239493/10000 =23.9493 ≒23 import datetime today = datetime.date.today() birth = 19991012 print ((int(today. 阅读全文
posted @ 2023-07-13 15:47 花生与酒 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 1、view和url传递参数 参数方式一: url.py path('xxx/', MailTemplateList.as_view(), name='MailTemplateList'), path('xxx/<str:id>/', MailTemplateList.as_view(), name 阅读全文
posted @ 2023-07-12 09:47 花生与酒 阅读(712) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2023-07-11 17:10 花生与酒 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 1、推荐 oauth provider server https://pypi.org/project/django-oauth-toolkit/ django-oauth-toolkit.readthedocs.io 相关介绍: https://www.cnblogs.com/liuweida/p 阅读全文
posted @ 2023-07-11 15:18 花生与酒 阅读(68) 评论(0) 推荐(0) 编辑
摘要: https://qiita.com/ANKM0/items/8fb032b6af7e64756d69 类似于这个页面 在考核系统中,我是用的 tamplate tag,关联读取显示的信息 {% if field.name == "beikao_user" %} {{ field }} {{ user 阅读全文
posted @ 2023-07-10 16:49 花生与酒 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 中文例子和讲解: https://www.cnblogs.com/waltsmith/p/8088099.html https://realpython.com/tutorials/django/ Table of Contents Creating a Django Project Getting 阅读全文
posted @ 2023-07-10 15:41 花生与酒 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 1、使用ModelFormSet,一般都要设定default数,方法如下 class Memo(models.Model): title = models.CharField('タイトル', max_length=20) text = models.TextField('内容') class Mem 阅读全文
posted @ 2023-07-10 10:16 花生与酒 阅读(20) 评论(0) 推荐(0) 编辑
摘要: calories隐含字段,通过计算得出的例子 from django import forms from .models import Nutrient class NutrientForm(forms.ModelForm): name = forms.CharField(label='食品名', 阅读全文
posted @ 2023-07-10 09:59 花生与酒 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 有图像的话,肯定不知保存,需要改变图像的像素,大小等,这就需要第三方的lib pip install -U django-imagekit pip install -U Pillow settings.py 里面,追加imagekit ,MEDIA_URL,MEDIA_ROOT model.py f 阅读全文
posted @ 2023-07-09 17:58 花生与酒 阅读(70) 评论(0) 推荐(0) 编辑
摘要: 特点就是: 在form_valid验证中,完成数据的验证或者解析 urls.py from django.urls import path from .views import UploadView urlpatterns = [ path('', UploadView.as_view(), nam 阅读全文
posted @ 2023-07-09 17:15 花生与酒 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 如果django fileField, imageField不是默认存在 本地服务器,而是远程云服务器上,则使用 django-storages 可以对应很多云服务器如 Amazon S3 Azure Storage DropBox Google Cloud Storage Apache Libcl 阅读全文
posted @ 2023-07-09 16:36 花生与酒 阅读(18) 评论(0) 推荐(0) 编辑
摘要: Django S3存储之腾讯云-对象存储 (env) D:\env\mysite>pip install boto3 (env) D:\env\mysite>pip install django-storages https://simpleisbetterthancomplex.com/tutor 阅读全文
posted @ 2023-07-07 11:06 花生与酒 阅读(14) 评论(0) 推荐(0) 编辑
摘要: https://www.5axxw.com/wiki/content/28uwws http://www.duoduokou.com/django/22100261690008133083.html class BlogPostStateChoices(models.TextChoices): DR 阅读全文
posted @ 2023-07-06 16:54 花生与酒 阅读(17) 评论(0) 推荐(0) 编辑
摘要: https://www.treejs.cn/v3/main.php#_zTreeInfo 官方文档,demo和api https://www.cnblogs.com/fonour/p/zTree.html https://www.cnblogs.com/longlyseul/p/12111143.h 阅读全文
posted @ 2023-07-06 14:41 花生与酒 阅读(67) 评论(0) 推荐(0) 编辑