Skip to content

Commit

Permalink
fix error migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
irfanpule committed May 29, 2020
1 parent 2b62975 commit 32cf3be
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from django.core.management.base import BaseCommand
from academy.apps.offices.models import Setting


class Command(BaseCommand):
help = 'To Seeding Initial Settings data'

def handle(self, *args, **options):
Setting.objects.update_or_create(
name="Apperance",
defaults={
'site_name': 'NolSatu',
'footer_title': 'PT. Boer Technology (Btech)',
'footer_url': 'https://btech.id/',
}
)
16 changes: 1 addition & 15 deletions academy/apps/offices/migrations/0009_setting_favicon.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
# Generated by Django 2.2.10 on 2020-04-06 04:53

from django.db import migrations, models
from academy.apps.offices.models import Setting


def initial_apperance(apps, schema_editor):
# initial apperance setting data
Setting.objects.update_or_create(
name="Apperance",
defaults={
'site_name': 'NolSatu',
'footer_title': 'PT. Boer Technology (Btech)',
'footer_url': 'https://btech.id/',
}
)


class Migration(migrations.Migration):
Expand All @@ -27,6 +14,5 @@ class Migration(migrations.Migration):
model_name='setting',
name='favicon',
field=models.ImageField(blank=True, null=True, upload_to='images/settings'),
),
migrations.RunPython(initial_apperance),
)
]
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ Migrate database
$ python manage.py migrate
```

Run this command to seeding initial data settings

```
$ python manage.py seeding_initial_settings
```

Collect Static

```
Expand Down

0 comments on commit 32cf3be

Please sign in to comment.