Initial commit
This commit is contained in:
2
djangoldp_example/__init__.py
Normal file
2
djangoldp_example/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
__version__ = '0.0.0'
|
||||
name = "djangoldp_example"
|
4
djangoldp_example/admin.py
Normal file
4
djangoldp_example/admin.py
Normal file
@ -0,0 +1,4 @@
|
||||
from django.contrib import admin
|
||||
from .models import ExampleModel
|
||||
|
||||
admin.site.register(ExampleModel)
|
4
djangoldp_example/apps.py
Normal file
4
djangoldp_example/apps.py
Normal file
@ -0,0 +1,4 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
class DjangoldpExampleConfig(AppConfig):
|
||||
name = 'djangoldp_example'
|
12
djangoldp_example/factories.py
Normal file
12
djangoldp_example/factories.py
Normal file
@ -0,0 +1,12 @@
|
||||
import factory
|
||||
import hashlib
|
||||
from .models import ExampleModel
|
||||
from django.db.models.signals import post_save
|
||||
|
||||
@factory.django.mute_signals(post_save)
|
||||
class ExampleFactory(factory.django.DjangoModelFactory):
|
||||
class Meta:
|
||||
model = ExampleModel
|
||||
|
||||
# Please refer to Factory boy documentation
|
||||
# https://factoryboy.readthedocs.io
|
0
djangoldp_example/management/__init__.py
Normal file
0
djangoldp_example/management/__init__.py
Normal file
0
djangoldp_example/management/commands/__init__.py
Normal file
0
djangoldp_example/management/commands/__init__.py
Normal file
12
djangoldp_example/management/commands/mock_example.py
Normal file
12
djangoldp_example/management/commands/mock_example.py
Normal file
@ -0,0 +1,12 @@
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from djangoldp_example.factories import ExampleFactory
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Mock data'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('--size', type=int, default=0, help='Number of example to create')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
ExampleFactory.create_batch(options['size'], thread=thread)
|
||||
self.stdout.write(self.style.SUCCESS('Successful data mock install'))
|
0
djangoldp_example/migrations/__init__.py
Normal file
0
djangoldp_example/migrations/__init__.py
Normal file
4
djangoldp_example/models.py
Normal file
4
djangoldp_example/models.py
Normal file
@ -0,0 +1,4 @@
|
||||
from django.db import models
|
||||
|
||||
class ExampleModel(models.Model):
|
||||
# Please refer to Django documentation
|
9
djangoldp_example/urls.py
Normal file
9
djangoldp_example/urls.py
Normal file
@ -0,0 +1,9 @@
|
||||
"""djangoldp project URL Configuration"""
|
||||
from django.conf.urls import url
|
||||
from djangoldp.views import LDPViewSet
|
||||
|
||||
from .models import ExampleModel
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^examples/', LDPViewSet.urls(model=ExampleModel)),
|
||||
]
|
Reference in New Issue
Block a user