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
7bba2b5b
Unverified
Kaydet (Commit)
7bba2b5b
authored
Ock 25, 2018
tarafından
Uğur Özyılmazel
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Better filename generation from ModelName
üst
1b3799bf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
baseapp_create_model.py
...tions/baseapp/management/commands/baseapp_create_model.py
+9
-4
No files found.
applications/baseapp/management/commands/baseapp_create_model.py
Dosyayı görüntüle @
7bba2b5b
import
re
import
os
from
importlib
import
import_module
...
...
@@ -81,17 +82,21 @@ class Command(BaseCommand):
app_dir
=
os
.
path
.
join
(
settings
.
BASE_DIR
,
'applications'
,
app_name
)
model_file
=
os
.
path
.
join
(
app_dir
,
'models'
,
'{}.py'
.
format
(
model_name
.
lower
()))
dash_seperated_file_base_name
=
'_'
.
join
(
[
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'
)
admin_file
=
os
.
path
.
join
(
app_dir
,
'admin'
,
'{}.py'
.
format
(
model
_name
.
lower
()))
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
,
app_name
=
app_name
,
)
content_init_file
=
'from .{} import *
\n
'
.
format
(
model
_name
.
lower
())
content_init_file
=
'from .{} import *
\n
'
.
format
(
dash_seperated_file_base
_name
.
lower
())
content_admin_file
=
TEMPLATE_ADMINS
[
model_type
]
.
format
(
model_name
=
model_name
,
...
...
@@ -113,5 +118,5 @@ class Command(BaseCommand):
self
.
stdout
.
write
(
self
.
style
.
NOTICE
(
USER_REMINDER
.
format
(
app_name
=
app_name
,
model_name
=
model_name
,
model_name_lower
=
model
_name
.
lower
(),
model_name_lower
=
dash_seperated_file_base
_name
.
lower
(),
)))
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