Fakultas Ilmu Komputer UI

Commit 6c644dfd authored by Muhammad Ilham Peruzzi's avatar Muhammad Ilham Peruzzi
Browse files

Latihan 10 Automation

parent e9ecef94
# Generated by Django 2.2.5 on 2019-11-12 02:11
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-12-09 07:10
from __future__ import unicode_literals
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
......@@ -8,30 +11,21 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
migrations.CreateModel(
name='Token',
name='User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('email', models.EmailField(max_length=254)),
('uid', models.CharField(max_length=255)),
('email', models.EmailField(max_length=254, primary_key=True, serialize=False)),
],
),
migrations.CreateModel(
name='ListUser',
name='Token',
fields=[
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('email', models.EmailField(max_length=254, primary_key=True, serialize=False)),
('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')),
('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')),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('email', models.EmailField(max_length=254)),
('uid', models.CharField(default=uuid.uuid4, max_length=40)),
],
options={
'abstract': False,
},
),
]
# Generated by Django 2.2.5 on 2019-11-12 05:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('email', models.EmailField(max_length=254, unique=True)),
],
),
migrations.RemoveField(
model_name='listuser',
name='groups',
),
migrations.RemoveField(
model_name='listuser',
name='user_permissions',
),
migrations.DeleteModel(
name='Token',
),
migrations.DeleteModel(
name='ListUser',
),
]
# Generated by Django 2.2.5 on 2019-11-12 06:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0002_auto_20191112_1255'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='id',
),
migrations.AlterField(
model_name='user',
name='email',
field=models.EmailField(max_length=254, primary_key=True, serialize=False),
),
]
# Generated by Django 2.2.5 on 2019-11-12 06:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_auto_20191112_1300'),
]
operations = [
migrations.CreateModel(
name='Token',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('email', models.EmailField(max_length=254)),
('uid', models.CharField(max_length=255)),
],
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-12-09 06:48
from __future__ import unicode_literals
from django.db import migrations
def find_dupes(apps, schema_editor):
List = apps.get_model("lists", "List")
for list_ in List.objects.all():
items = list_.item_set.all()
texts = set()
for ix, item in enumerate(items):
if item.text in texts:
item.text = '{} ({})'.format(item.text, ix)
item.save()
texts.add(item.text)
class Migration(migrations.Migration):
dependencies = [
('lists', '0001_initial'),
]
operations = [
migrations.RunPython(find_dupes)
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-12-09 06:58
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('lists', '0002_remove_duplicates'),
]
operations = [
migrations.AlterModelOptions(
name='item',
options={'ordering': ('id',)},
),
migrations.AlterUniqueTogether(
name='item',
unique_together=set([('list', 'text')]),
),
]
# Generated by Django 2.2.5 on 2019-11-18 11:17
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-12-09 06:59
from __future__ import unicode_literals
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('accounts', '0004_token'),
('lists', '0003_unique_together'),
]
operations = [
migrations.AlterField(
model_name='token',
name='uid',
field=models.CharField(default=uuid.uuid4, max_length=40),
migrations.AddField(
model_name='item',
name='slug',
field=models.SlugField(blank=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-12-09 07:00
from __future__ import unicode_literals
from django.db import migrations
from django.utils.text import slugify
def slugify_items(apps, schema_editor):
List = apps.get_model("lists", "List")
for list_ in List.objects.all():
items = list_.item_set.all()
for ix, item in enumerate(items):
item.slug = slugify(item.text)
item.save()
class Migration(migrations.Migration):
dependencies = [
('lists', '0004_item_slug'),
]
operations = [
migrations.RunPython(slugify_items)
]
......@@ -8,4 +8,9 @@ class List(models.Model):
class Item(models.Model):
text = models.TextField(default='')
list = models.ForeignKey(List, default=None,on_delete=models.CASCADE)
slug = models.SlugField(blank=True)
class Meta:
ordering = ('id',)
unique_together = ('list', 'text')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment