-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
301 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ omit = | |
manage.py, | ||
setup.py, | ||
.tox/*, | ||
site_packages/* | ||
site_packages/* | ||
project_template/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class {{ camel_case_app_name }}Config(AppConfig): | ||
name = "{{ app_name }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django import forms | ||
|
||
from .models import {{ camel_case_app_name }} | ||
|
||
|
||
class {{ camel_case_app_name }}Form(forms.ModelForm): | ||
class Meta: | ||
fields = '__all__' | ||
model = {{ camel_case_app_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*-*- encoding: utf-8 -*-*- | ||
|
||
from django.db import models | ||
|
||
|
||
class {{ camel_case_app_name }}(models.Model): | ||
# Add DB fields | ||
|
||
# Optional add __str__ | ||
# def __str__(self): | ||
# return self.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django.conf.urls import url | ||
|
||
from . import views | ||
|
||
app_name = "{{ app_name }}" | ||
|
||
urlpatterns = [url(r"^$", views.{{ camel_case_app_name }}ListView.as_view(), name="list"), | ||
url(r"^create/$", views.{{ camel_case_app_name }}CreateView.as_view(), name="create"), | ||
url(r"^(?P<pk>\d+)/$", views.{{ camel_case_app_name }}UpdateView.as_view(), name="detail"), | ||
url(r"^(?P<pk>\d+)/delete/$", views.{{ camel_case_app_name }}DeleteView.as_view(), name="delete"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from django.urls import reverse, reverse_lazy | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
from arctic.generics import ( | ||
CreateView, | ||
DeleteView, | ||
ListView, | ||
UpdateView, | ||
) | ||
|
||
from .forms import {{ camel_case_app_name }}Form | ||
from .models import {{ camel_case_app_name }} | ||
|
||
|
||
class {{ camel_case_app_name }}ListView(ListView): | ||
model = {{ camel_case_app_name }} | ||
fields = '__all__' | ||
permission_required = 'view_{{ app_name }}' | ||
|
||
# Delete and detail action link | ||
action_links = [ | ||
("detail", "{{ app_name}}:detail", "fa-edit"), | ||
("delete", "{{ app_name}}:delete", "fa-trash"), | ||
] | ||
|
||
# tool link to create | ||
tool_links = [ | ||
(_("Create {{ app_name }}"), "{{ app_name }}:create", "fa-plus"), | ||
] | ||
|
||
# Some optional fields | ||
# paginate_by = 10 | ||
# ordering_fields = ['field_name1', ..] | ||
# search_fields = ['field_name', ...] | ||
# allowed_exports = ["csv"] | ||
|
||
|
||
class {{ camel_case_app_name }}CreateView(CreateView): | ||
model = {{ camel_case_app_name }} | ||
form_class = {{ camel_case_app_name }}Form | ||
permission_required = 'add_{{ app_name }}' | ||
|
||
def get_success_url(self): | ||
return reverse("{{app_name}}:detail", args=(self.object.pk,)) | ||
|
||
|
||
class {{ camel_case_app_name }}UpdateView(UpdateView): | ||
model = {{ camel_case_app_name }} | ||
form_class = {{ camel_case_app_name }}Form | ||
permission_required = 'change_{{ app_name }}' | ||
success_url = reverse_lazy('{{app_name}}:list') | ||
actions = [ | ||
(_("Cancel"), "cancel"), | ||
(_("Save"), "submit"), | ||
] | ||
|
||
|
||
class {{ camel_case_app_name }}DeleteView(DeleteView): | ||
model = {{ camel_case_app_name }} | ||
success_url = reverse_lazy('{{app_name}}:list') | ||
permission_required = 'delete_{{ app_name }}' |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.