質問編集履歴

1

migrationファイルを追加

2020/06/18 06:46

投稿

ikalemon
ikalemon

スコア16

test CHANGED
File without changes
test CHANGED
@@ -195,3 +195,133 @@
195
195
 
196
196
 
197
197
  ```
198
+
199
+
200
+
201
+ ```migration
202
+
203
+ ##migrationファイルです。userモデルも設定しているので、その記述も入っています。
204
+
205
+
206
+
207
+ # Generated by Django 2.1.15 on 2020-06-17 17:31
208
+
209
+
210
+
211
+ import cms.models
212
+
213
+ from django.conf import settings
214
+
215
+ import django.contrib.auth.validators
216
+
217
+ from django.db import migrations, models
218
+
219
+ import django.db.models.deletion
220
+
221
+ import django.utils.timezone
222
+
223
+
224
+
225
+
226
+
227
+ class Migration(migrations.Migration):
228
+
229
+
230
+
231
+ initial = True
232
+
233
+
234
+
235
+ dependencies = [
236
+
237
+ ('auth', '0009_alter_user_last_name_max_length'),
238
+
239
+ ]
240
+
241
+
242
+
243
+ operations = [
244
+
245
+ migrations.CreateModel(
246
+
247
+ name='User',
248
+
249
+ fields=[
250
+
251
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
252
+
253
+ ('password', models.CharField(max_length=128, verbose_name='password')),
254
+
255
+ ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
256
+
257
+ ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
258
+
259
+ ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
260
+
261
+ ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
262
+
263
+ ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
264
+
265
+ ('email', models.EmailField(max_length=254, unique=True, verbose_name='email address')),
266
+
267
+ ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
268
+
269
+ ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
270
+
271
+ ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
272
+
273
+ ('twitter', models.CharField(blank=True, max_length=50, verbose_name='Twitter')),
274
+
275
+ ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
276
+
277
+ ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
278
+
279
+ ],
280
+
281
+ options={
282
+
283
+ 'verbose_name': 'user',
284
+
285
+ 'verbose_name_plural': 'users',
286
+
287
+ 'abstract': False,
288
+
289
+ 'swappable': 'AUTH_USER_MODEL',
290
+
291
+ },
292
+
293
+ managers=[
294
+
295
+ ('objects', cms.models.UserManager()),
296
+
297
+ ],
298
+
299
+ ),
300
+
301
+ migrations.CreateModel(
302
+
303
+ name='Work',
304
+
305
+ fields=[
306
+
307
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
308
+
309
+ ('title', models.CharField(max_length=255, verbose_name='タイトル')),
310
+
311
+ ('contents', models.CharField(blank=True, max_length=255, verbose_name='欲しいもの')),
312
+
313
+ ('create_date', models.DateTimeField(default=django.utils.timezone.now)),
314
+
315
+ ('fav', models.IntegerField(verbose_name='いいね数')),
316
+
317
+ ('create_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
318
+
319
+ ],
320
+
321
+ ),
322
+
323
+ ]
324
+
325
+
326
+
327
+ ```