摘要:
safe |safe 可以當作html的tag渲染 in view: context['user_content1']="<b>Hello</b>"context['user_content2']="<b>Hello</b>"return render(request, template_name
閱讀全文
posted @ 2025-10-13 15:21
花生與酒
閱讀(4)
推薦(0)
摘要:
背景:用原生和用element plus處理checkbox group 提交全部用原生view 用django 原生,解決數據回顯時候頁面數據checked狀態 django 若在model定義,只有 models.ManyToManyField(Category) # Default: Sele
閱讀全文
posted @ 2025-10-11 10:36
花生與酒
閱讀(5)
推薦(0)
摘要:
一、model可以定義的基本類型 from django.db import models class ExampleModel(models.Model): # CharField name = models.CharField(max_length=100) # Default: TextInp
閱讀全文
posted @ 2025-09-23 17:40
花生與酒
閱讀(12)
推薦(0)
摘要:
一主軸方向、默認橫線排布 flex-row(默認)。flex-column是豎向排列 <div class="d-flex "> <div class="p-2 bg-primary text-white">Item 1</div> <div class="p-2 bg-success text-w
閱讀全文
posted @ 2025-09-15 10:58
花生與酒
閱讀(10)
推薦(0)
摘要:
背景:下面是學校 、 班級 、學生表 學校 5個校 班級 3所校,各有3個班級 學生 3個校的第1個班級,才有學生 1、查詢所有班的學生數 SELECT b.id, b.name, COUNT(s.id) as student_countFROM t_ban bLEFT JOIN t_stu s O
閱讀全文
posted @ 2025-09-10 16:18
花生與酒
閱讀(6)
推薦(0)
posted @ 2025-08-15 14:35
花生與酒
閱讀(11)
推薦(0)
摘要:
In Django, you can retrieve data from a request using either request.POST or request.body, depending on the content type of the request and how the da
閱讀全文
posted @ 2024-09-05 17:46
花生與酒
閱讀(53)
推薦(0)
摘要:
1. 使用媒體創建工具創建 Windows 10 可啟動 USB 先到 :https://www.microsoft.com/en-in/software-download/windows10 下載安裝,然后運行 準備一個大的u盤,插入 啟動U盤制成后, 把電腦改成u盤啟動,然后安裝即可
閱讀全文
posted @ 2024-07-24 17:15
花生與酒
閱讀(25)
推薦(0)
摘要:
https://www.sassy-blog.com/entry/20210714/1626230852 pip install django-maintenance-mode setting.pyの設定 INSTALLED_APPS = [ 'maintenance_mode', ] MIDDLE
閱讀全文
posted @ 2024-07-23 10:40
花生與酒
閱讀(11)
推薦(0)
摘要:
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:48
花生與酒
閱讀(49)
推薦(0)
摘要:
Start a project django-admin startproject registrationForm Project directory registration/settings.py # Application definitionINSTALLED_APPS = [ 'djan
閱讀全文
posted @ 2024-03-07 10:38
花生與酒
閱讀(67)
推薦(0)
摘要:
select STRING_AGG(schooltypeno,',') from dm.codeschooltype where schooltypeno like '36%' 361,367,369,363,365,364,362,366 select tablename, case when s
閱讀全文
posted @ 2024-03-04 11:01
花生與酒
閱讀(23)
推薦(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
花生與酒
閱讀(20)
推薦(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
花生與酒
閱讀(15)
推薦(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
花生與酒
閱讀(55)
推薦(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
花生與酒
閱讀(33)
推薦(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:37
花生與酒
閱讀(159)
推薦(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
花生與酒
閱讀(35)
推薦(0)
摘要:
這個插件已經再tryformset/product中引入了js等。 但尚未實驗實現。
閱讀全文
posted @ 2023-09-06 11:13
花生與酒
閱讀(17)
推薦(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
花生與酒
閱讀(75)
推薦(0)
摘要:
一、定義model時,使用校驗 検証內容バリデーションクラス 正規表現によるチェック RegexValidator 最小文字數 MinLengthValidator 最大文字數 MaxLengthValidator 最小値 MinValueValidator 最大値 MaxValueValidato
閱讀全文
posted @ 2023-09-01 16:17
花生與酒
閱讀(50)
推薦(0)
摘要:
1、托入幾個矩形,當1、2級菜單 2.、 菜單全選,右鍵,轉為動態面板,動態面板命名為一級菜單名稱 3、系統管理面板,默認是狀態1 ,里面有3個按鈕, 狀態1->改為展開, 再增加一個關閉狀態 (1)雙擊系統管理面板, (2)新增狀態 (3)把展開狀態的系統管理菜單, 復制到關閉狀態里 4、展開狀態
閱讀全文
posted @ 2023-08-23 12:00
花生與酒
閱讀(419)
推薦(0)
摘要:
django-allauth 可以郵件電話登錄,也可以用百度等第三方賬號登錄 custom user,郵件登錄 https://qiita.com/Kei-Segawa/items/aa38f72fc5409a3517c6 另一個例子 https://qiita.com/t-shirayama/it
閱讀全文
posted @ 2023-07-21 10:22
花生與酒
閱讀(24)
推薦(0)
摘要:
https://qiita.com/skokado/items/a25d64cafa3db791b283
閱讀全文
posted @ 2023-07-21 09:19
花生與酒
閱讀(27)
推薦(0)
摘要:
https://qiita.com/godan09/items/13866970972bf3a1c243 PDFで見積書を出力するにあたって関連ライブラリのメリデメを洗い出してみました。 そのライブラリの中で実裝方法とアウトプットを提示し、比較できる狀態にしすることが本稿の目的です。 この記事は2つ
閱讀全文
posted @ 2023-07-20 17:28
花生與酒
閱讀(39)
推薦(0)
摘要:
querydict和普通dict區別較大 mutable=True才可以編輯,默認不可修改 >>> from django.http import QueryDict >>> qd = QueryDict('spam=1&egg=2') # get で取得すると文字列が返る >>> qd.get('
閱讀全文
posted @ 2023-07-20 17:19
花生與酒
閱讀(28)
推薦(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:18
花生與酒
閱讀(33)
推薦(0)
摘要:
検証內容バリデーションクラス 正規表現によるチェック RegexValidator 最小文字數 MinLengthValidator 最大文字數 MaxLengthValidator 最小値 MinValueValidator 最大値 MaxValueValidato class Item(mode
閱讀全文
posted @ 2023-07-19 10:21
花生與酒
閱讀(17)
推薦(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
花生與酒
閱讀(24)
推薦(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
花生與酒
閱讀(32)
推薦(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
花生與酒
閱讀(45)
推薦(0)
摘要:
可以用來做后臺任務,可以在django view中調用,當做異步任務 考核系統中要的 threading,用來異步考核結果和考核進度的統計 Python的多線程(threading)與多進程(multiprocessing )
閱讀全文
posted @ 2023-07-16 10:43
花生與酒
閱讀(44)
推薦(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
花生與酒
閱讀(40)
推薦(0)
摘要:
Certbotインストール bash sudo apt install certbot Nginxを停止 bash sudo systemctl stop nginx 👆をしないと、certbotで証明書を発行するときエラーになる HTTPSポート(443ポート)開放 EC2 > セキュリティ >
閱讀全文
posted @ 2023-07-14 10:23
花生與酒
閱讀(18)
推薦(0)
摘要:
900 是緩存900秒,sidebar_latest_posts 是緩存表示, 一般用于template的動態菜單,加載時候減少數據庫訪問量 {% load cache %} {% cache 900 sidebar_latest_posts %} <h3>最新文章</h3> <ul> {% for
閱讀全文
posted @ 2023-07-13 17:04
花生與酒
閱讀(7)
推薦(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:46
花生與酒
閱讀(132)
推薦(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
花生與酒
閱讀(993)
推薦(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:09
花生與酒
閱讀(81)
推薦(0)
摘要:
1、推薦 oauth provider server https://pypi.org/project/django-oauth-toolkit/ django-oauth-toolkit.readthedocs.io 相關介紹: http://www.rzrgm.cn/liuweida/p
閱讀全文
posted @ 2023-07-11 15:18
花生與酒
閱讀(146)
推薦(0)
摘要:
https://qiita.com/ANKM0/items/8fb032b6af7e64756d69 類似于這個頁面 在考核系統中,我是用的 tamplate tag,關聯讀取顯示的信息 {% if field.name == "beikao_user" %} {{ field }} {{ user
閱讀全文
posted @ 2023-07-10 16:49
花生與酒
閱讀(26)
推薦(0)