{"id":2537,"date":"2021-02-02T11:57:18","date_gmt":"2021-02-02T02:57:18","guid":{"rendered":"https:\/\/qol-kk.com\/wp2\/?p=2537"},"modified":"2021-02-08T09:13:23","modified_gmt":"2021-02-08T00:13:23","slug":"post-2537","status":"publish","type":"post","link":"https:\/\/qol-kk.com\/wp2\/blog\/2021\/02\/02\/post-2537\/","title":{"rendered":"Django\uff1a\u30ed\u30b0\u30a4\u30f3\u5f8c\u306b\u5225\u30a2\u30d7\u30ea\uff08CMS\u30b3\u30f3\u30d1\u30cd\uff09\u306b\u98db\u3070\u305d\u3046\u3068\u3057\u3066\u60a9\u3093\u3060\u4ef6"},"content":{"rendered":"<h2>Django\uff1a\u30ed\u30b0\u30a4\u30f3\u5f8c\u306b\u5225\u30a2\u30d7\u30ea\uff08CMS\u30b3\u30f3\u30d1\u30cd\uff09\u306b\u98db\u3070\u305d\u3046\u3068\u3057\u3066\u60a9\u3093\u3060\u4ef6<\/h2>\n<p>\u73fe\u5728\u4f5c\u6210\u3057\u3066\u3044\u308b\u30b5\u30a4\u30c8\u304c\u307b\u307c\u51fa\u6765\u4e0a\u304c\u3063\u305f\u306e\u3067\u3001\u6b21\u306f\u64cd\u4f5c\u90e8\u3002<br \/>\n\u300c\u30b5\u30a4\u30c8\u3092Django\u3067\u66f8\u3044\u3066\u308b\u3093\u3060\u304b\u3089CMS\u306b\u3057\u306a\u3044\u3068\u306d\u300d\u3068\u8a00\u3046\u4e8b\u3067\u3001\u30ed\u30b0\u30a4\u30f3\u5f8c\u306eCMS\u30b3\u30f3\u30d1\u30cd\u306e\u4f5c\u6210\u306a\u306e\u3067\u3059\u304c\u3001\u3053\u3053\u3067\u30c1\u30e7\u30c3\u30c8\u8e93\u304d\u307e\u3057\u305f\u3002<br \/>\n\u4eca\u73fe\u72b6\u3082\u6700\u826f\u306e\u89e3\u6c7a\u306a\u306e\u304b\u308f\u304b\u3089\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u3088\u308b\u7be9\u5206\u3051\u3082\u3067\u304d\u308b\u306e\u3067\u53d6\u308a\u5408\u3048\u305a\u5f62\u306b\u306a\u3063\u305f\u304b\u306a\u3068\u3002<\/p>\n<h3>\u300e\u3084\u308a\u305f\u3044\u3053\u3068\u300f\u306b\u3064\u3044\u3066<\/h3>\n<p>\u3084\u308a\u305f\u3044\u3053\u3068\u306f\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<div class=\"borderBox\">\n<ol>\n<li>\u30ed\u30b0\u30a4\u30f3\u5f8c\u3001\u30b5\u30a4\u30c8\u69cb\u7bc9\u7528\u753b\u9762(CMS\u30b3\u30f3\u30d1\u30cd)\u306bJUMP<\/li>\n<li>\u30e6\u30fc\u30b6\u30fc\u306e\u30e9\u30f3\u30af(\u30ed\u30fc\u30eb)\u306b\u3088\u3063\u3066\u8868\u793a\u3059\u308b\u5185\u5bb9\u3092\u5909\u66f4(\u3075\u308b\u3044\u5206\u3051)<\/li>\n<\/ol>\n<\/div>\n<p>\u305d\u306e\u305f\u3081\u306e\u69cb\u6210\u3068\u3057\u3066\u63a1\u7528\u3057\u305f\u306e\u304c\u3010accounts\u30a2\u30d7\u30ea\u3011\u3067\u3059\u3002<\/p>\n<h3>accounts\u30a2\u30d7\u30ea\u306e\u5c0e\u5165\u306b\u3064\u3044\u3066<\/h3>\n<p>\u4f5c\u696d\u306f\u305f\u3063\u305f2\u3064\u3067\u3059\u3002<\/p>\n<div class=\"borderBox\">\n<ol>\n<li>SSH\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u30b3\u30de\u30f3\u30c9\u5b9f\u884c [ python manage.py startapp accounts ]<\/li>\n<li>settings.py\u306baccounts\u30a2\u30d7\u30ea\u3092\u8ffd\u52a0<\/li>\n<\/ol>\n<\/div>\n<pre class=\"lang:default decode:true\">python manage.py startapp accounts<\/pre>\n<pre class=\"lang:python decode:true\">INSTALLED_APPS = [\r\n    'django.contrib.admin',\r\n    'django.contrib.auth',\r\n    'django.contrib.contenttypes',\r\n    'django.contrib.sessions',\r\n    'django.contrib.messages',\r\n    'django.contrib.staticfiles',\r\n    'django.contrib.sites',\r\n    'allauth',\r\n    'allauth.account',\r\n    'allauth.socialaccount',\r\n    # \u25bc\u8ffd\u52a0\u25bc\r\n    'accounts.apps.AccountsConfig',\r\n]<\/pre>\n<p>\u3053\u308c\u306f\u30b5\u30a4\u30c8\u69cb\u7bc9\u306e\u6700\u521d\u306e\u5de5\u7a0b\u3067\u6e96\u5099\u3057\u3066\u304a\u304b\u306a\u3044\u3068\u75db\u3044\u76ee\u898b\u308b\u305d\u3046\u3067\u3059\u3002<br \/>\n\u79c1\u306e\u74b0\u5883\u3067\u306f\u65e2\u306b\u5b9f\u884c\uff06\u5b9f\u88c5\u6e08\u307f\u3002\u306a\u306e\u3067\u3001\u30ed\u30b0\u30a4\u30f3\u306f\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u30ed\u30b0\u30a4\u30f3\u5f8c\u306e\u30b3\u30f3\u30d1\u30cd\u304c\u306a\u3044\u72b6\u614b\u3067\u3059\u3002<br \/>\n\u307e\u3041\u306d\u3001admin\u3067\u300eDjango \u7ba1\u7406\u30b5\u30a4\u30c8\u300f\u304b\u3089\u30c6\u30fc\u30d6\u30eb\u5f04\u308c\u308b\u3093\u3067\u30b3\u30f3\u30d1\u30cd\u9020\u4f5c\u4e0d\u8981\u3067\u3059\u304b\u3089\u3002<br \/>\n\u3067\u3082\u3001\u7d0d\u54c1\u3068\u306a\u308b\u3068\u300c\u300eDjango \u7ba1\u7406\u30b5\u30a4\u30c8\u300f\u3067\u5f04\u3063\u3066\u304f\u3060\u3055\u3044\u300d\u3063\u3066\u8a33\u306b\u3082\u3044\u304b\u306a\u3044\u306e\u3067\u30b3\u30f3\u30d1\u30cd\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<h3>\u4eca\u56de\u30cf\u30de\u3063\u305f\u30dd\u30a4\u30f3\u30c8<\/h3>\n<p>\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u5074\u30a2\u30d7\u30ea\u3068\u5225\u306b\u30b3\u30f3\u30d1\u30cd\u7528\u30a2\u30d7\u30ea\u3092\u7528\u610f\u3057\u307e\u3057\u305f\u3002<br \/>\n\u305d\u3057\u3066\u3001settings.py\u306b\u6b21\u306e\u3088\u3046\u306b\u8a18\u8f09\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"lang:python decode:true\">AUTH_USER_MODEL = 'accounts.CustomUser'\r\n\r\n#django-allauth\u3067\u5229\u7528\u3059\u308bdjango.contrib.sites\u3092\u4f7f\u3046\u70ba\u306b\u5dee\u7570\u3068\u8b58\u5225\u7528ID\u3092\u8a2d\u5b9a\r\nSITE_ID = 1\r\n\r\n#\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u8a8d\u8a3c\u306b\u5909\u66f4\u3059\u308b\u8a2d\u5b9a\r\nACCOUNT_AUTHENTICATION_METHOD = 'email'\r\nACCOUNT_USERNAME_REQUIRED = False\r\n\r\n#\u30b5\u30a4\u30f3\u30a2\u30c3\u30d7\u306b\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u631f\u3080(\u9001\u4fe1\u3059\u308b)\u3088\u3046\u8a2d\u5b9a(none=\u9001\u4fe1\u3057\u306a\u3044, mandatory=\u9001\u4fe1\u3059\u308b)\r\nACCOUNT_EMAIL_VERIFICATION = 'none'\r\nACCOUNT_EMAIL_REQUIRED = True\r\n\r\n#\u30ed\u30b0\u30a4\u30f3\u30fb\u30ed\u30b0\u30a2\u30a6\u30c8\u5f8c\u306e\u9077\u79fb\u5148\u3092\u8a2d\u5b9a\r\nLOGIN_REDIRECT_URL = 'cop:index'\r\nACCOUNT_LOGOUT_REDIRECT_URL = 'web:index'\r\n\r\n#\u30ed\u30b0\u30a2\u30a6\u30c8\u30ea\u30f3\u30af\u306e\u30af\u30ea\u30c3\u30af\u4e00\u767a\u3067\u30ed\u30b0\u30a2\u30a6\u30c8\u3059\u308b\u8a2d\u5b9a\r\nACCOUNT_LOGOUT_ON_GET = True<\/pre>\n<p>15\u884c\u76ee\u306f\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148URL\u306e\u767b\u9332\u3002\u3053\u3053\u306b\u30b3\u30f3\u30d1\u30cd\u30a2\u30d7\u30ea(cop)\u306eindex\u3078JUMP\u3059\u308b\u3088\u3046\u767b\u9332\u3057\u307e\u3057\u305f\u3002<br \/>\n16\u884c\u76ee\u306f\u30ed\u30b0\u30a2\u30a6\u30c8\u3057\u305f\u6642\u306e\u753b\u9762\u9077\u79fb\u5148\u3067\u3059\u3002<\/p>\n<p>\u3067\u3001\u30ed\u30b0\u30a4\u30f3\u51e6\u7406\u3092\u5b9f\u884c\u3059\u308b\u3068\u3053\u3093\u306a\u30a8\u30e9\u30fc\u304c\u3067\u3066\u30ed\u30b0\u30a4\u30f3\u306e\u51e6\u7406\u3082\u3057\u3066\u304f\u308c\u306a\u304f\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/image.jpg\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2539\" data-permalink=\"https:\/\/qol-kk.com\/wp2\/blog\/2021\/02\/02\/post-2537\/image-26\/\" data-orig-file=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/image.jpg\" data-orig-size=\"793,390\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"NoReverseMatch.jpg\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/image.jpg\" class=\"alignnone size-medium wp-image-2539\" src=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/image-300x148.jpg\" alt=\"NoReverseMatch at \/accounts\/login\/\" width=\"300\" height=\"148\" srcset=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/image-300x148.jpg 300w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/image-768x378.jpg 768w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/image.jpg 793w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u8272\u3005\u8abf\u3079\u3066\u307f\u308b\u3068\u3001\u3053\u306e\u73fe\u8c61\u306fPOST\u306e\u5148\u304c\u30a2\u30d7\u30ea\u3092\u8d85\u3048\u308b\u3068\u304d\u306b\u767a\u751f\u3059\u308b\u3089\u3057\u3044\u3002<\/p>\n<h3>\u89e3\u6c7a\u306b\u5411\u3051\u305f\u60c5\u5831\u304c\u8f09\u3063\u3066\u3044\u308b\u30b5\u30a4\u30c8<\/h3>\n<p>\u307e\u305a\u306f\u89e3\u6c7a\u3067\u304d\u308b\u60c5\u5831\u5148\u306e\u30b5\u30a4\u30c8\u30ea\u30f3\u30af\u3092\u8a18\u8f09\u3057\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/docs.djangoproject.com\/ja\/2.2\/intro\/tutorial04\/#write-a-simple-form\">Django\u516c\u5f0f<\/a>\u3000\/\u3000<a href=\"https:\/\/linus-mk.hatenablog.com\/entry\/2019\/12\/27\/095855\">\u53c2\u8003\u30b5\u30a4\u30c8<\/a><\/p>\n<h3>\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u3084\u3063\u3066\u307f\u305f\u5b9f\u9a13\u3068\u305d\u306e\u7d50\u679c<\/h3>\n<p>\u30a8\u30e9\u30fc\u3092\u8d85\u3048\u308b\u65b9\u6cd5\u306f\u308f\u304b\u3063\u305f\u306e\u3067\u300c\u3061\u3087\u3046\u3069\u826f\u3044\u6a5f\u4f1a\u300d\u3068\u601d\u3044\u5b9f\u9a13\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<div class=\"paperBox\">\n<ol>\n<li>LOGIN_REDIRECT_URL = 'cop:index' \u3000\u3068\u3057\u3066\u3000URL:\/accounts\/login\u3000\u304b\u3089\u30ed\u30b0\u30a4\u30f3<\/li>\n<li>LOGIN_REDIRECT_URL = 'cop:index'\u3000\u3068\u3057\u3066\u3000URL:\/accounts\/login\/?next=\/cop\/\u3000\u304b\u3089\u30ed\u30b0\u30a4\u30f3<\/li>\n<li>LOGIN_REDIRECT_URL = '\/cop\/'\u3000\u3068\u3057\u3066\u3000URL:\/accounts\/login\u3000\u304b\u3089\u30ed\u30b0\u30a4\u30f3<\/li>\n<li>LOGIN_REDIRECT_URL = '\/accounts\/login\/'\u3000\u3068\u3057\u3066\u3000URL:\/accounts\/login\u3000\u304b\u3089\u30ed\u30b0\u30a4\u30f3<\/li>\n<li>LOGIN_REDIRECT_URL = ''\u3000\u3068\u3057\u3066\u3000URL:\/accounts\/login\u3000\u304b\u3089\u30ed\u30b0\u30a4\u30f3<\/li>\n<\/ol>\n<\/div>\n<h4>\u7d50\u679c<\/h4>\n<div class=\"borderBox\">\n<ul>\n<li>\u30ed\u30b0\u30a4\u30f3\uff06\u753b\u9762\u9077\u79fb\u6210\u529f\u3010\u5b9f\u9a132 \/ 5\u3011<\/li>\n<li>\u30ed\u30b0\u30a4\u30f3\u6210\u529f\uff06\u753b\u9762\u9077\u79fb\u5931\u6557\u3010\u5b9f\u9a134\u3011<\/li>\n<li>\u30ed\u30b0\u30a4\u30f3\u5931\u6557\uff06\u753b\u9762\u9077\u79fb\u5931\u6557\u3010\u5b9f\u9a131 \/ 3\u3011<\/li>\n<\/ul>\n<\/div>\n<p>\u5b9f\u9a13\u7d50\u679c\u304b\u3089\u308f\u304b\u308b\u901a\u308a\u3001\u30ed\u30b0\u30a4\u30f3\u51e6\u7406\u30da\u30fc\u30b8\u3092\u63d0\u4f9b\u3057\u3066\u3044\u308b\u30a2\u30d7\u30ea\u3068\u5225\u306e\u30a2\u30d7\u30ea\u3078\u753b\u9762\u9077\u79fb\u3059\u308b\u5834\u5408\u306f1\u3064\u306e\u4f8b\u5916\u3092\u9664\u3044\u3066\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>1\u3064\u306e\u4f8b\u5916\u3068\u306f\u3001GET\u3067\u30ed\u30b0\u30a4\u30f3\u5f8c\u306e\u9077\u79fb\u5148\u3092\u6307\u5b9a\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002\u203b\u4e0a\u306e\u3010\u5b9f\u9a132\u3011\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u3064\u307e\u308a\u306f\u3001\u3053\u306e\u904e\u7a0b\u3067\u767a\u751f\u3057\u3066\u3044\u308b\u30a8\u30e9\u30fc\u306f\u300e\u30ed\u30b0\u30a4\u30f3\u5f8c\u306e\u753b\u9762\u9077\u79fb\u5148\u4e0d\u660e\u300f\u3067\u767a\u751f\u3057\u3066\u3044\u308b\u308f\u3051\u3067\u3059\u3002<\/p>\n<h3>\u539f\u56e0\u306f\u5206\u304b\u3063\u305f\u3001\u5bfe\u5fdc\u7b56\u306f\uff1f<\/h3>\n<p>\u300e\u9077\u79fb\u5148\u4e0d\u660e\u300f\u3067\u767a\u751f\u3057\u3066\u3044\u308b\u306a\u3089\u300c\u9077\u79fb\u5148\u3092\u660e\u78ba\u306b\u3059\u308c\u3070\u3088\u3044\u300d\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\n\u30b0\u30b0\u3063\u3066\u51fa\u3066\u304f\u308b\u5bfe\u5fdc\u7b56\u3092\u307e\u3068\u3081\u308b\u30684\u901a\u308a\u307b\u3069\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<div class=\"paperBox\">\n<ol>\n<li>\u30ed\u30b0\u30a4\u30f3\u5f8c\u306e\u30b3\u30f3\u30d1\u30cd\u3092\u5225\u30a2\u30d7\u30ea\u3067\u7acb\u3061\u4e0a\u3052\u306a\u3044 \u203b\u540c\u4e00\u30a2\u30d7\u30ea\u5185\u3067\u4f5c\u6210\u3059\u308b<\/li>\n<li>app\\urls.py\u306b\u9077\u79fb\u5148URL\u3092\u660e\u793a\u3057\u3066\u304a\u304f \u203b\u5225\u30a2\u30d7\u30ea\u5185\u306emodels.py\u3092import\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308b<\/li>\n<li>\u30ed\u30b0\u30a4\u30f3URL\u306b\u5fc5\u305a [ ?next= ] \u3092\u4ed8\u3051\u3066\u904b\u7528\u3059\u308b \u203b\u904b\u7528\u3067\u306e\u30ab\u30d0\u30fc\u3001get\u306e\u306a\u3044\u5834\u5408\u306f\u5909\u308f\u3089\u305a\u30a8\u30e9\u30fc\u767a\u751f<\/li>\n<li>\u540c\u4e00\u30a2\u30d7\u30ea\u5185\u306b\u30ed\u30b0\u30a4\u30f3\u5f8c\u306e\u9077\u79fb\u5148\u3092\u7528\u610f\u3001\u305d\u3053\u304b\u3089redirect\u306b\u3066\u5225\u30a2\u30d7\u30ea\u306e\u30b3\u30f3\u30d1\u30cd\u306b\u8a98\u5c0e\u3059\u308b<\/li>\n<\/ol>\n<\/div>\n<p>\u4eca\u56de\u306f\u3010\u9805\u76ee4\u3011\u306e\u65b9\u6cd5\u3092\u63a1\u7528\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<h3>\u30ed\u30b0\u30a4\u30f3\u5f8c\u306e\u9077\u79fb\u5148\u3067\u5225\u30a2\u30d7\u30ea\u306e\u30b3\u30f3\u30d1\u30cd\u306b\u8a98\u5c0e\u3059\u308b<\/h3>\n<div class=\"borderBox\">\n<ol>\n<li>settings.py \u306e LOGIN_REDIRECT_URL \u306b app:sieving \u3092\u767b\u9332 \u203bapp=\u30c9\u30e1\u30a4\u30f3\u76f4\u4e0b\u306eindex\u3092\u7ba1\u7406\u3059\u308b\u30a2\u30d7\u30ea<\/li>\n<li>app\\views.py \u306b def SievingView(request) \u3092\u4f5c\u6210 \u203b\u6700\u521d\u306e\u7be9\u5206\u3051\u3092\u8a18\u8f09\uff08\u3053\u3053\u304capp:sieving\uff09<\/li>\n<li>views.SievingView\u3092app\\urls.py\u306b\u767b\u9332<\/li>\n<li>2\u3067\u8a18\u8f09\u3057\u305f\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148\uff08cop\\index\uff09\u3092\u4f5c\u6210\u3057 groups_id\uff08role\uff09\u3067\u9077\u79fb\u30da\u30fc\u30b8\u3092\u5909\u3048\u308b\u203b2\u6bb5\u968e\u76ee\u306e\u7be9\u5206\u3051<\/li>\n<\/ol>\n<\/div>\n<p>\u4f5c\u696d\u3068\u3057\u3066\u306f\u4e0a\u306e\u901a\u308a\u3067\u3059\u3002<br \/>\n\u30dd\u30a4\u30f3\u30c8\u306f2\u9805\u76ee\u306e\u5225\u30a2\u30d7\u30ea\u306eredirect\u3092\u8a18\u8f09\u3059\u308b\u969b\u306b\u3010HttpResponseRedirect\u3011\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u3002<br \/>\n\u30ce\u30fc\u30de\u30eb\u306aredirect\u3092\u547c\u3073\u51fa\u3059\u3068\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3059\u3002<\/p>\n<h3>\u5b9f\u969b\u306b\u66f8\u3044\u305f\u30b9\u30af\u30ea\u30d7\u30c8<\/h3>\n<p>\u25a0setting.py<\/p>\n<pre class=\"lang:default decode:true\">(\u524d\u7565)\r\n#\u30ed\u30b0\u30a4\u30f3\u30fb\u30ed\u30b0\u30a2\u30a6\u30c8\u5f8c\u306e\u9077\u79fb\u5148\u3092\u8a2d\u5b9a\r\nLOGIN_REDIRECT_URL = 'app:sieving'\r\nACCOUNT_LOGOUT_REDIRECT_URL = 'app:index'<\/pre>\n<p>\u25a0app\\views.py<\/p>\n<pre class=\"\">(\u524d\u7565)\r\nfrom django.shortcuts import render,redirect\r\nfrom django.http import HttpResponseRedirect\r\n(\u4e2d\u7565)\r\n@login_required\r\ndef SievingView(request):\r\n    if request.user.is_authenticated:\r\n      \"\"\"\u30ed\u30b0\u30a4\u30f3\u30e6\u30fc\u30b6\u30fc\u306b\u5bfe\u3059\u308b\u51e6\u7406\"\"\"\r\n      return HttpResponseRedirect('\/cop')#\u30b3\u30f3\u30d1\u30cd\u306b\u9077\u79fb\r\n    else:\r\n      \"\"\"\u533f\u540d\u30e6\u30fc\u30b6\u30fc\u306b\u5bfe\u3059\u308b\u51e6\u7406\"\"\"\r\n      return redirect('\/accounts\/logout')#\u5f37\u5236\u30ed\u30b0\u30a2\u30a6\u30c8<\/pre>\n<p>\u25a0app\\urls.py<\/p>\n<pre class=\"\">from django.urls import path\r\nfrom . import views\r\n(\u4e2d\u7565)\r\nurlpatterns = [\r\n(\u4e2d\u7565)\r\n  path('sieving', views.SievingView, name=\"sieving\"),#\u8ffd\u52a0\r\n]<\/pre>\n<p>\u25a0cop\\views.py<\/p>\n<pre class=\"lang:default decode:true\">import logging\r\nimport datetime\r\nfrom django.shortcuts import render\r\nfrom django.contrib.auth.decorators import login_required\r\nfrom web.models import Contents\r\n\r\nlogger = logging.getLogger(__name__)\r\n@login_required\r\ndef CopIndexView(request):\r\n    if request.user.is_authenticated:\r\n        \"\"\"\u30e6\u30fc\u30b6\u30fc\u540d \u53d6\u5f97\u5408\u6210\"\"\"\r\n        user = request.user.last_name + \" \" + request.user.first_name\r\n        if request.user.groups_id == 1:\r\n          #\u958b\u767a\u8005Console\u306b\u9077\u79fb\r\n          return render(request, 'creator\/index.html')\r\n        elif request.user.groups_id== 2:\r\n          #\u7ba1\u7406\u8005Console\u306b\u9077\u79fb\r\n          return render(request, 'manager\/index.html')\r\n        elif request.user.groups_id== 3:\r\n          #\u5229\u7528\u8005Console\u306b\u9077\u79fb\r\n          return render(request, 'user\/index.html')\r\n        else:\r\n          #ROLE\u8a2d\u5b9a(groups_id)\u306e\u306a\u3044\u5834\u5408\u306f\u5f37\u5236\u30ed\u30b0\u30a2\u30a6\u30c8\r\n          return HttpResponseRedirect('\/accounts\/logout')<\/pre>\n<h4>\u30c1\u30e7\u30c3\u30c8\u89e3\u8aac<\/h4>\n<p>Laravel\u3067\u306frole\u3068\u3044\u3046\u5024\u3092\u5165\u308c\u3066\u3044\u307e\u3057\u305f\u304c\u3001<del datetime=\"2021-02-08T00:06:57+00:00\">Django\u306eaccounts\u30a2\u30d7\u30ea\u3067\u306f\u521d\u671f\u5024\u3067groups_id\u3068\u3044\u3046\u30ab\u30e9\u30e0\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306f\u4e00\u7dd2\u306b\u4f5c\u6210\u3055\u308c\u3066\u3044\u308b\u3010accounts_customuser_groups\u3011\u30c6\u30fc\u30d6\u30eb\u3068\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u304c\u5f35\u3089\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u3044\u3064\u3092\u4f7f\u3048\u3070\u3001\u30ed\u30b0\u30a4\u30f3\u5f8c\u306e\u51e6\u7406\u306e\u51e6\u7406\u5206\u3051\uff08\u51e6\u7406\u306e\u53ef\u5426\u542b\u3081\uff09\u304c\u51fa\u6765\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/del><\/p>\n<p><strong>2020\/02\/08\u8ffd\u8a18<\/strong><br \/>\n\u3054\u3081\u3093\u306a\u3055\u3044\u3001groups_id \u3068\u305d\u306e\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u306f\u81ea\u5206\u3067\u4fee\u6b63\u3057\u3066\u3044\u305f\u3088\u3046\u3067\u3059\u3002<br \/>\ndjango-allauth\u306e\u521d\u671f\u5024\u306b\u5165\u3063\u3066\u3044\u308b\u306e\u306f\u3010groups\u3011\u3068\u3044\u3046\u30ab\u30e9\u30e0\u3067\u3057\u305f\u3002<br \/>\n\u3060\u3044\u3076\u524d\u306b\u5916\u89b3\u3060\u3051\u69cb\u6210\u3057\u305f\u969b\u306b\u4f5c\u3063\u3066\u3044\u305f\u3088\u3046\u3067\u3059\u3002\u8aa4\u60c5\u5831\u7533\u3057\u8a33\u3054\u3056\u3044\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<h3>\u307e\u3068\u3081<\/h3>\n<p>\u4eca\u56de\u5b9f\u88c5\u3057\u305f\u5f62\u304c\u6700\u5584\u3067\u3042\u308b\u306e\u304b\u3001\u307e\u3060\u307e\u3060\u300c\u3084\u308a\u3088\u3046\u300d\u306f\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u3041\u305d\u308c\u3067\u3082\u30a2\u30a4\u30c7\u30a3\u30a2\u3067\u3053\u3053\u307e\u3067\u306f\u4f5c\u308c\u308b\u305e\u3068\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Django\uff1a\u30ed\u30b0\u30a4\u30f3\u5f8c\u306b\u5225\u30a2\u30d7\u30ea\uff08CMS\u30b3\u30f3\u30d1\u30cd\uff09\u306b\u98db\u3070\u305d\u3046\u3068\u3057\u3066\u60a9\u3093\u3060\u4ef6 \u73fe\u5728\u4f5c\u6210\u3057\u3066\u3044\u308b\u30b5\u30a4\u30c8\u304c\u307b\u307c\u51fa\u6765\u4e0a\u304c\u3063\u305f\u306e\u3067\u3001\u6b21\u306f\u64cd\u4f5c\u90e8\u3002 \u300c\u30b5\u30a4\u30c8\u3092Django\u3067\u66f8\u3044\u3066\u308b\u3093\u3060\u304b\u3089CMS\u306b\u3057\u306a\u3044\u3068\u306d\u300d\u3068\u8a00\u3046\u4e8b\u3067\u3001\u30ed\u30b0\u30a4\u30f3\u5f8c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2174,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[38],"tags":[843,814,99,147,97,53,724,912,361],"class_list":["post-2537","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-memorandum","tag-cms","tag-django","tag-mysql","tag-python","tag-97","tag-53","tag-724","tag-912","tag-361"],"veu_head_title_object":{"title":"","add_site_title":""},"jetpack_publicize_connections":[],"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2020\/11\/django.png","_links":{"self":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/2537","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/comments?post=2537"}],"version-history":[{"count":0,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/2537\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media\/2174"}],"wp:attachment":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media?parent=2537"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/categories?post=2537"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/tags?post=2537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}