質問編集履歴

8

誤字の修正

2020/09/28 02:40

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -74,7 +74,7 @@
74
74
 
75
75
  kwargs = super(CompanyCreateView,self).get_form_kwargs()
76
76
 
77
- kwargs['test_sevice_id'] =self.kwargs['sevice_id'] #service_idはパラメータ
77
+ kwargs['test_service_id'] =self.kwargs['sevice_id'] #service_idはパラメータ
78
78
 
79
79
  return kwargs
80
80
 

7

情報の追加

2020/09/28 02:40

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -522,6 +522,8 @@
522
522
 
523
523
 
524
524
 
525
+
526
+
525
527
  ### 補足情報(FW/ツールのバージョンなど)
526
528
 
527
529
 

6

情報の追加

2020/09/27 23:18

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -426,6 +426,54 @@
426
426
 
427
427
  ```
428
428
 
429
+ ディレクトリ構造
430
+
431
+ ```ここに言語を入力
432
+
433
+ myproject
434
+
435
+ |_company
436
+
437
+ |___pycache__
438
+
439
+ |_migrations
440
+
441
+ |___init__.py
442
+
443
+ |_admin.py
444
+
445
+ |_forms.py
446
+
447
+ |_models.py
448
+
449
+ |_tests.py
450
+
451
+ |_urls.py
452
+
453
+ |_views.py
454
+
455
+ |_config
456
+
457
+ |___pycache__
458
+
459
+ |___init__.py
460
+
461
+ |_settings.py
462
+
463
+ |_urls.py
464
+
465
+ |_wsgi.py
466
+
467
+ |_templates
468
+
469
+ |_company
470
+
471
+ |_form.html
472
+
473
+ |_base.html
474
+
475
+ ```
476
+
429
477
  ### 発生している問題・エラーメッセージ
430
478
 
431
479
 

5

情報の追加

2020/09/27 23:12

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -388,6 +388,44 @@
388
388
 
389
389
  ```
390
390
 
391
+ ●form.html
392
+
393
+ ```html
394
+
395
+ {% extends 'base.html' %}
396
+
397
+
398
+
399
+ {% block content %}
400
+
401
+ <div>
402
+
403
+ <h4>企業情報</h4>
404
+
405
+
406
+
407
+ <form method="post">
408
+
409
+ <table>
410
+
411
+ {% csrf_token %}
412
+
413
+ {{ form.as_p }}
414
+
415
+ </table>
416
+
417
+ <input type="submit" value="保存">
418
+
419
+ </form>
420
+
421
+
422
+
423
+ </div>
424
+
425
+ {% endblock %}
426
+
427
+ ```
428
+
391
429
  ### 発生している問題・エラーメッセージ
392
430
 
393
431
 

4

情報の修正

2020/09/27 23:01

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -278,7 +278,7 @@
278
278
 
279
279
  },
280
280
 
281
- "jp-indexpro": {
281
+ "db2": {
282
282
 
283
283
  "ENGINE": "sql_server.pyodbc",
284
284
 

3

情報の追加

2020/09/27 22:59

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -104,6 +104,290 @@
104
104
 
105
105
  ```
106
106
 
107
+ ●settings.py
108
+
109
+ ```python
110
+
111
+ """
112
+
113
+ Django settings for config project.
114
+
115
+
116
+
117
+ Generated by 'django-admin startproject' using Django 2.2.12.
118
+
119
+
120
+
121
+ For more information on this file, see
122
+
123
+ https://docs.djangoproject.com/en/2.2/topics/settings/
124
+
125
+
126
+
127
+ For the full list of settings and their values, see
128
+
129
+ https://docs.djangoproject.com/en/2.2/ref/settings/
130
+
131
+ """
132
+
133
+
134
+
135
+ import os
136
+
137
+
138
+
139
+ # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
140
+
141
+ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
142
+
143
+
144
+
145
+
146
+
147
+ # Quick-start development settings - unsuitable for production
148
+
149
+ # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
150
+
151
+
152
+
153
+ # SECURITY WARNING: keep the secret key used in production secret!
154
+
155
+ SECRET_KEY = 'l_dil%jvy7)9f5%gr8fn(4sl0cx&tuc__o3!kf&1fzi-cw$+!e'
156
+
157
+
158
+
159
+ # SECURITY WARNING: don't run with debug turned on in production!
160
+
161
+ DEBUG = True
162
+
163
+
164
+
165
+ ALLOWED_HOSTS = ['127.0.0.1']
166
+
167
+
168
+
169
+
170
+
171
+ # Application definition
172
+
173
+
174
+
175
+ INSTALLED_APPS = [
176
+
177
+ 'company.apps.CompanyConfig',
178
+
179
+ 'django.contrib.admin',
180
+
181
+ 'django.contrib.auth',
182
+
183
+ 'django.contrib.contenttypes',
184
+
185
+ 'django.contrib.sessions',
186
+
187
+ 'django.contrib.messages',
188
+
189
+ 'django.contrib.staticfiles',
190
+
191
+ ]
192
+
193
+
194
+
195
+ MIDDLEWARE = [
196
+
197
+ 'django.middleware.security.SecurityMiddleware',
198
+
199
+ 'django.contrib.sessions.middleware.SessionMiddleware',
200
+
201
+ 'django.middleware.common.CommonMiddleware',
202
+
203
+ 'django.middleware.csrf.CsrfViewMiddleware',
204
+
205
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
206
+
207
+ 'django.contrib.messages.middleware.MessageMiddleware',
208
+
209
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
210
+
211
+ ]
212
+
213
+
214
+
215
+ ROOT_URLCONF = 'config.urls'
216
+
217
+
218
+
219
+ TEMPLATES = [
220
+
221
+ {
222
+
223
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
224
+
225
+ 'DIRS': [os.path.join(BASE_DIR, 'templates')],
226
+
227
+ 'APP_DIRS': True,
228
+
229
+ 'OPTIONS': {
230
+
231
+ 'context_processors': [
232
+
233
+ 'django.template.context_processors.debug',
234
+
235
+ 'django.template.context_processors.request',
236
+
237
+ 'django.contrib.auth.context_processors.auth',
238
+
239
+ 'django.contrib.messages.context_processors.messages',
240
+
241
+ ],
242
+
243
+ },
244
+
245
+ },
246
+
247
+ ]
248
+
249
+
250
+
251
+ WSGI_APPLICATION = 'config.wsgi.application'
252
+
253
+
254
+
255
+
256
+
257
+ # Database
258
+
259
+ # https://docs.djangoproject.com/en/2.2/ref/settings/#databases
260
+
261
+
262
+
263
+ DATABASES = {
264
+
265
+ 'default': {
266
+
267
+ "ENGINE": "django.db.backends.mysql",
268
+
269
+ "NAME": "dbname",
270
+
271
+ "USER": "user",
272
+
273
+ "PASSWORD": "password",
274
+
275
+ "HOST": "hostname",
276
+
277
+ "PORT": "3306",
278
+
279
+ },
280
+
281
+ "jp-indexpro": {
282
+
283
+ "ENGINE": "sql_server.pyodbc",
284
+
285
+ "NAME": "dbname",
286
+
287
+ "USER": "user",
288
+
289
+ "PASSWORD": "password",
290
+
291
+ "HOST": "hostname",
292
+
293
+ "PORT": "",
294
+
295
+ "OPTIONS": {
296
+
297
+ "driver": "ODBC Driver 17 for SQL Server"
298
+
299
+ }
300
+
301
+ }
302
+
303
+ }
304
+
305
+
306
+
307
+ # Password validation
308
+
309
+ # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
310
+
311
+
312
+
313
+ AUTH_PASSWORD_VALIDATORS = [
314
+
315
+ {
316
+
317
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
318
+
319
+ },
320
+
321
+ {
322
+
323
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
324
+
325
+ },
326
+
327
+ {
328
+
329
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
330
+
331
+ },
332
+
333
+ {
334
+
335
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
336
+
337
+ },
338
+
339
+ ]
340
+
341
+
342
+
343
+
344
+
345
+ # Internationalization
346
+
347
+ # https://docs.djangoproject.com/en/2.2/topics/i18n/
348
+
349
+
350
+
351
+ LANGUAGE_CODE = 'ja'
352
+
353
+
354
+
355
+ TIME_ZONE = 'Asia/Tokyo'
356
+
357
+
358
+
359
+ USE_I18N = True
360
+
361
+
362
+
363
+ USE_L10N = True
364
+
365
+
366
+
367
+ USE_TZ = True
368
+
369
+
370
+
371
+
372
+
373
+ # Static files (CSS, JavaScript, Images)
374
+
375
+ # https://docs.djangoproject.com/en/2.2/howto/static-files/
376
+
377
+
378
+
379
+ STATIC_URL = '/static/'
380
+
381
+ STATICFILES_DIRS = (
382
+
383
+ os.path.join(BASE_DIR, "static"),
384
+
385
+ )
386
+
387
+
388
+
389
+ ```
390
+
107
391
  ### 発生している問題・エラーメッセージ
108
392
 
109
393
 

2

補足情報追記

2020/09/27 22:56

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -80,6 +80,30 @@
80
80
 
81
81
  ```
82
82
 
83
+ ●urls.py
84
+
85
+ ```python
86
+
87
+ from django.urls import path
88
+
89
+
90
+
91
+ from . import views
92
+
93
+
94
+
95
+ app_name = 'company'
96
+
97
+
98
+
99
+ urlpatterns = [
100
+
101
+ path('<int:company_id>/create/<int:sevice_id>', views.CompanyCreateView.as_view(), name='service_create'),
102
+
103
+ ]
104
+
105
+ ```
106
+
83
107
  ### 発生している問題・エラーメッセージ
84
108
 
85
109
 

1

文章の修正

2020/09/27 22:52

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- DjangoでviewからFormオブジェクトに値を渡したい
1
+ djangoでviewからFormオブジェクトに値を渡したい
test CHANGED
File without changes