14 lines
410 B
Python
14 lines
410 B
Python
from django.core.management.base import BaseCommand
|
|
from minecraft.items import ITEMS
|
|
from minecraft.models import Item
|
|
|
|
class Command(BaseCommand):
|
|
help = 'Import default items into the database'
|
|
|
|
def handle(self, *args, **options):
|
|
for i in ITEMS:
|
|
if i['durability'] == 0:
|
|
item,created = Item.objects.get_or_create(material=i['id'])
|
|
if created:
|
|
print "Imported", item
|