Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django2-project-template
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django2-project-template
Commits
e883dfc9
Unverified
Kaydet (Commit)
e883dfc9
authored
May 02, 2018
tarafından
Uğur Özyılmazel
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix: model creator management command
üst
7525a217
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
7 deletions
+33
-7
baseapp_create_model.py
...tions/baseapp/management/commands/baseapp_create_model.py
+33
-7
No files found.
applications/baseapp/management/commands/baseapp_create_model.py
Dosyayı görüntüle @
e883dfc9
...
...
@@ -54,8 +54,18 @@ class Command(BaseCommand):
f
.
write
(
content
)
def
add_arguments
(
self
,
parser
):
parser
.
add_argument
(
'app_name'
,
nargs
=
1
,
type
=
str
,
help
=
'Name of your application'
)
parser
.
add_argument
(
'model_name'
,
nargs
=
1
,
type
=
str
,
help
=
'Name of your model'
)
parser
.
add_argument
(
'app_name'
,
nargs
=
1
,
type
=
str
,
help
=
'Name of your application'
,
)
parser
.
add_argument
(
'model_name'
,
nargs
=
1
,
type
=
str
,
help
=
'Name of your model'
,
)
parser
.
add_argument
(
'model_type'
,
nargs
=
'?'
,
...
...
@@ -65,7 +75,7 @@ class Command(BaseCommand):
def
handle
(
self
,
*
args
,
**
options
):
app_name
=
options
.
pop
(
'app_name'
)[
0
]
model_name
=
options
.
pop
(
'model_name'
)[
0
]
model_name
=
options
.
pop
(
'model_name'
)[
0
]
.
title
()
model_type
=
options
.
pop
(
'model_type'
)
try
:
...
...
@@ -86,11 +96,27 @@ class Command(BaseCommand):
[
m
for
m
in
re
.
split
(
'([A-Z][a-z]+)'
,
model_name
)
if
m
]
)
model_file
=
os
.
path
.
join
(
app_dir
,
'models'
,
'{}.py'
.
format
(
dash_seperated_file_base_name
.
lower
()))
model_init_file
=
os
.
path
.
join
(
app_dir
,
'models'
,
'__init__.py'
)
model_file
=
os
.
path
.
join
(
app_dir
,
'models'
,
'{}.py'
.
format
(
dash_seperated_file_base_name
.
lower
()),
)
model_init_file
=
os
.
path
.
join
(
app_dir
,
'models'
,
'__init__.py'
,
)
admin_file
=
os
.
path
.
join
(
app_dir
,
'admin'
,
'{}.py'
.
format
(
dash_seperated_file_base_name
.
lower
()))
admin_init_file
=
os
.
path
.
join
(
app_dir
,
'admin'
,
'__init__.py'
)
admin_file
=
os
.
path
.
join
(
app_dir
,
'admin'
,
'{}.py'
.
format
(
dash_seperated_file_base_name
.
lower
()),
)
admin_init_file
=
os
.
path
.
join
(
app_dir
,
'admin'
,
'__init__.py'
,
)
content_model_file
=
TEMPLATE_MODELS
[
model_type
]
.
format
(
model_name
=
model_name
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment