文章分类 -  django - 简单项目 - 学习笔记

摘要:1. 启用media urls 设置 from app import views from django.urls import path, re_path from django.views.static import serve from django.conf import settings 阅读全文
posted @ 2022-06-10 10:30 我在春天等伱 阅读(136) 评论(0) 推荐(0)
摘要:1. html {% extends 'layout.html' %} {% block content %} <div class="container"> <!-- Button trigger modal --> <button type="button" class="btn btn-suc 阅读全文
posted @ 2022-06-06 15:12 我在春天等伱 阅读(55) 评论(0) 推荐(0)
摘要:1. html 其中 <td>{{ item.user.user }}</td> 关联表的字段名 {% extends 'layout.html' %} {% block content %} <div class="container"> <!-- Button trigger modal --> 阅读全文
posted @ 2022-06-05 14:54 我在春天等伱 阅读(109) 评论(0) 推荐(0)
摘要:1. 登录login.py 页面中必须有代码 def login(request): if request.method =='GET': form = LoginForm() return render(request, 'login.html', {'form': form}) form = L 阅读全文
posted @ 2022-06-02 10:45 我在春天等伱 阅读(42) 评论(0) 推荐(0)
摘要:1. 重置密码 # 重置密码 class AdminChongZhi(BootstrapModelForm): chong_pwd = forms.CharField( label='确认密码', widget=forms.PasswordInput # 密码被清空 # widget=forms.P 阅读全文
posted @ 2022-05-31 13:16 我在春天等伱 阅读(205) 评论(0) 推荐(0)
摘要:用户注册 确认密码 1. md5密码加密 :adminpy 代码 from django import forms from django.shortcuts import render, redirect # 输出错误信息 from django.core.exceptions import Va 阅读全文
posted @ 2022-05-30 20:38 我在春天等伱 阅读(191) 评论(0) 推荐(0)
摘要:1. 让时间成为现择方式 1. 引入css 样式 必须在bootstrap css 后面 {% block css %} <link rel="stylesheet" href="{% static 'css/bootstrap-datetimepicker.min.css' %}"> {% end 阅读全文
posted @ 2022-05-30 11:35 我在春天等伱 阅读(428) 评论(0) 推荐(0)
摘要:1. 案例代码 : ''' 自定义分页组件 views.py 代码 from app.utils.pagetions import Pagetions queryset = models.Number.objects.filter(**data_dict).order_by('id') page_o 阅读全文
posted @ 2022-05-28 15:09 我在春天等伱 阅读(42) 评论(0) 推荐(0)
摘要:1. 搜索手机号页面代码 html 页面代码 <form class="navbar-form navbar-right" method="get"> <div class="form-group"> <input type="text" name="q" class="form-control" 阅读全文
posted @ 2022-05-27 17:19 我在春天等伱 阅读(56) 评论(0) 推荐(0)
摘要:1. model.py 生成数据库代码 #手机靓号 class Number(models.Model): '''手机靓号''' mobile = models.CharField(max_length=11, verbose_name='手机号码') price = models.IntegerF 阅读全文
posted @ 2022-05-27 14:09 我在春天等伱 阅读(129) 评论(0) 推荐(0)
摘要:1. views.py 页面 使用modelform 必须顶一个类 class BumenModelForm(forms.ModelForm): 使用所有字段 : fields = '__all__' # fields = ['name' , 'pwd'] 使用字段 批量生成样式 from djan 阅读全文
posted @ 2022-05-24 12:59 我在春天等伱 阅读(84) 评论(0) 推荐(0)
摘要:1. urls.py 增 删 查 urlpatterns = [ # 用户 path('user_list/', views.user_list), path('user_add/', views.user_add), path('user_detele/', views.user_detele), 阅读全文
posted @ 2022-05-24 10:26 我在春天等伱 阅读(93) 评论(0) 推荐(0)
摘要:1.数据源 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 华中理工大学:ht 阅读全文
posted @ 2022-05-24 10:18 我在春天等伱 阅读(100) 评论(0) 推荐(0)