Django
setting py
PREFECTURES = [
("北海道" ,"北海道" ),
("青森県" ,"青森県" ),
("岩手県" ,"岩手県" ),
("宮城県" ,"宮城県" ),
("秋田県" ,"秋田県" ),
("山形県" ,"山形県" ),
("福島県" ,"福島県" ),
("茨城県" ,"茨城県" ),
("栃木県" ,"栃木県" ),
("群馬県" ,"群馬県" ),
("埼玉県" ,"埼玉県" ),
("千葉県" ,"千葉県" ),
("東京都" ,"東京都" ),
("神奈川県" ,"神奈川県"),
("新潟県" ,"新潟県" ),
("富山県" ,"富山県" ),
("石川県" ,"石川県" ),
("福井県" ,"福井県" ),
("山梨県" ,"山梨県" ),
("長野県" ,"長野県" ),
("岐阜県" ,"岐阜県" ),
("静岡県" ,"静岡県" ),
("愛知県" ,"愛知県" ),
("三重県" ,"三重県" ),
("滋賀県" ,"滋賀県" ),
("京都府" ,"京都府" ),
("大阪府" ,"大阪府" ),
("兵庫県" ,"兵庫県" ),
("奈良県" ,"奈良県" ),
("和歌山県" ,"和歌山県"),
("鳥取県" ,"鳥取県" ),
("島根県" ,"島根県" ),
("岡山県" ,"岡山県" ),
("広島県" ,"広島県" ),
("山口県" ,"山口県" ),
("徳島県" ,"徳島県" ),
("香川県" ,"香川県" ),
("愛媛県" ,"愛媛県" ),
("高知県" ,"高知県" ),
("福岡県" ,"福岡県" ),
("佐賀県" ,"佐賀県" ),
("長崎県" ,"長崎県" ),
("熊本県" ,"熊本県" ),
("大分県" ,"大分県" ),
("宮崎県" ,"宮崎県" ),
("鹿児島県" ,"鹿児島県"),
("沖縄県" ,"沖縄県" ),
]
GENDERS = [
("男性" ,"男性" ),
("女性" ,"女性" ),
]
EMPLOYMENTSTATUSS = [
( "正社員" ,"正社員" ),
( "派遣社員" ,"派遣社員" ),
( "契約社員" ,"契約社員" ),
( "業務委託" ,"業務委託" ),
( "アルバイト" ,"アルバイト" ),
( "正職員" ,"正職員" ),
( "非常勤" ,"非常勤" ),
]
COMPANYS = [
( "管理部" ,"管理部" ),
( "営業部" ,"営業部" ),
( "システム部" ,"システム部" ),
( "財務経理部" ,"財務経理部" ),
( "法務部" ,"法務部" ),
( "総務人事部" ,"総務人事部" ),
]
JYOBS = [
( "経営管理部" ,"経営管理部" ),
( "事業企画部" ,"事業企画部" ),
( "品質管理部" ,"品質管理部" ),
( "第一営業部" ,"第一営業部" ),
( "第二営業部" ,"第二営業部" ),
( "財務部" ,"財務部" ),
( "経理部" ,"経理部" ),
( "インフラ設計G" ,"インフラ設計G" ),
( "開発設計G" ,"開発設計G" ),
( "法務課" ,"法務課" ),
( "総務課" ,"総務課" ),
( "人事課" ,"人事課" ),
( "広報企画部" ,"広報企画部" ),
( "人材管理T" ,"人材管理T" ),
( "採用T" ,"採用T" ),
]
STAYS = [
("千代田区" ,"千代田区" ),
("中央区" ,"中央区" ),
("港区" ,"港区" ),
("渋谷区" ,"渋谷区" ),
("新宿区" ,"新宿区" ),
("豊島区" ,"豊島区" ),
("文京区" ,"文京区" ),
("品川区" ,"品川区" ),
("目黒区" ,"目黒区" ),
("大田区" ,"大田区" ),
("世田谷区" ,"世田谷区" ),
("中野区" ,"中野区" ),
("杉並区" ,"杉並区" ),
("練馬区" ,"練馬区"),
("板橋区" ,"板橋区" ),
("北区" ,"北区" ),
("足立区" ,"足立区" ),
("葛飾区" ,"葛飾区" ),
("荒川区" ,"荒川区" ),
("台東区" ,"台東区" ),
("墨田区" ,"墨田区" ),
("江東区" ,"江東区" ),
("江戸川区" ,"江戸川区" ),
]
AFFILIATONS = [
( "フロントラインT" ,"フロントラインT" ),
( "プロモーションT" ,"プロモーションT" ),
( "IセールスT" ,"IセールスT" ),
( "CサクセスT" ,"CサクセスT" ),
( "事業管理T" ,"事業管理T" ),
( "構成管理T" ,"構成管理T" ),
( "品質管理T" ,"品質管理T" ),
( "会計1課" ,"会計1課" ),
( "会計2課" ,"会計2課" ),
( "設計構築T" ,"設計構築T" ),
( "運用保守T" ,"運用保守T" ),
( "設計開発T" ,"設計開発T" ),
( "広報T" ,"広報T" ),
( "企画T" ,"企画T" ),
( "第一法務部" ,"第一法務部" ),
( "第二法務部" ,"第二法務部" ),
( "人材管理T" ,"人材管理T" ),
( "採用T" ,"採用T" ),
]
POSITIONS = [
( "メンバー" ,"メンバー" ),
( "リーダー" ,"リーダー" ),
( "PL" ,"PL" ),
( "PMO" ,"PMO" ),
( "PM" ,"PM" ),
( "係長" ,"係長" ),
( "部長" ,"部長" ),
( "課長" ,"課長" ),
("会社役員" ,"会社役員" ),
("取締役" ,"取締役" ),
]
ANNUALS= [
( "200" ,"200" ),
( "250" ,"250" ),
( "300" ,"300" ),
( "350" ,"350" ),
( "400" ,"400" ),
( "450" ,"450" ),
( "500" ,"500" ),
( "550" ,"550" ),
( "600" ,"600" ),
( "650" ,"650" ),
( "700" ,"700" ),
( "750" ,"750" ),
( "800~" ,"800~" ),
]
LASTYEARS = [
( "200" ,"200" ),
( "250" ,"250" ),
( "300" ,"300" ),
( "350" ,"350" ),
( "400" ,"400" ),
( "450" ,"450" ),
( "500" ,"500" ),
( "550" ,"550" ),
( "600" ,"600" ),
( "650" ,"650" ),
( "700" ,"700" ),
( "750" ,"750" ),
( "800~" ,"800~" ),
]
models.py
models.py
from django.db import models
from django.conf import settings
from django.core.validators import MinValueValidator, MaxValueValidator
from django.core.validators import MinLengthValidator #☆
#プルダウンメニュー
class Member(models.Model):
name = models.CharField(verbose_name="名前",max_length=100)
prefecture = models.CharField(verbose_name="出身地",choices=settings.PREFECTURES,max_length=100)
gender = models.CharField(verbose_name="性別",choices=settings.GENDERS,max_length=100)
employmentstatus = models.CharField(verbose_name="雇用形態",choices=settings.EMPLOYMENTSTATUSS,max_length=100)
company= models.CharField(verbose_name="業種",choices=settings.COMPANYS,max_length=100)
jyob = models.CharField(verbose_name="配属部署",choices=settings.JYOBS,max_length=100)
stay= models.CharField(verbose_name="現住所",choices=settings.STAYS,max_length=100)
affiliation = models.CharField(verbose_name="所属先",choices=settings.AFFILIATONS,max_length=100)
postion = models.CharField(verbose_name="現役職",choices=settings.POSITIONS,max_length=100)
annual = models.CharField(verbose_name="今年(万)",choices=settings.ANNUALS,max_length=100)
lastyear = models.CharField(verbose_name="昨年(万)",choices=settings.LASTYEARS,max_length=100)
def __str__(self):
return '<Member:id=' + str(self.id) + ', ' + \
self.name + '(' + str(self.name) + ')>'
以下Laravel
config/prefecture.php
<?php
return array(
'0' => '',
'1' => '北海道',
'2' => '青森県',
'3' => '岩手県',
'4' => '宮城県',
'5' => '秋田県',
'6' => '山形県',
'7' => '福島県',
'8' => '茨城県',
'9' => '栃木県',
'10' => '群馬県',
'11' => '埼玉県',
'12' => '千葉県',
'13' => '東京都',
'14' => '神奈川県',
'15' => '新潟県',
'16' => '富山県',
'17' => '石川県',
'18' => '福井県',
'19' => '山梨県',
'20' => '長野県',
'21' => '岐阜県',
'22' => '静岡県',
'23' => '```愛知県',
'24' => '三重県',。
'25' => '滋賀県',
'26' => '京都府',
'27' => '大阪府',
'28' => '兵庫県',
'29' => '奈良県',
'30' => '和歌山県',
'31' => '鳥取県',
'32' => '島根県',
'33' => '岡山県',
'34' => '広島県',
'35' => '山口県',
'36' => '徳島県',
'37' => '香川県',
'38' => '愛媛県',
'39' => '高知県',
'40' => '福岡県',
'41' => '佐賀県',
'42' => '長崎県',
'43' => '熊本県',
'44' => '大分県',
'45' => '宮崎県',
'46' => '鹿児島県',
'47' => '沖縄県'
);
?>
resources/views/posts/create.blade.php
<div class="form-group">
<tr><th>出身地</th><td>
<select type="text" class="form-control" name="prefecture">
@foreach(config('prefecture') as $key => $score)
<option value="{{ $score }}">{{ $score }}</option>
@endforeach
</select>
@error('prefecture')
<div class="error">{{ $message }}</div>
@enderror
</div>
django
メリットは何を実装するか何となくわかりやすい。
デメリットはあまりカスタマイズには向かない
Laravel
メリットはカスタマイズが豊富
デメリットはカスタマイズしすぎと意味不明なコードになってしまう。
以上です。