Kaynağa Gözat

[minor] fixes for custom field and website route length

version-14
Rushabh Mehta 9 yıl önce
ebeveyn
işleme
a9e3df6e82
3 değiştirilmiş dosya ile 10 ekleme ve 6 silme
  1. +6
    -3
      frappe/custom/doctype/custom_field/custom_field.py
  2. +2
    -1
      frappe/utils/fixtures.py
  3. +2
    -2
      frappe/website/website_generator.py

+ 6
- 3
frappe/custom/doctype/custom_field/custom_field.py Dosyayı Görüntüle

@@ -33,6 +33,8 @@ class CustomField(Document):
if not self.idx:
self.idx = len(fieldnames) + 1

self._old_fieldtype = self.db_get('fieldtype')

if not self.fieldname:
frappe.throw(_("Fieldname not set for Custom Field"))

@@ -44,9 +46,10 @@ class CustomField(Document):
validate_fields_for_doctype(self.dt)

# update the schema
# if not frappe.flags.in_test:
from frappe.model.db_schema import updatedb
updatedb(self.dt)
if (self.fieldname not in frappe.db.get_table_columns(self.dt)
or self._old_fieldtype != self.fieldtype):
from frappe.model.db_schema import updatedb
updatedb(self.dt)

def on_trash(self):
# delete property setter entries


+ 2
- 1
frappe/utils/fixtures.py Dosyayı Görüntüle

@@ -20,7 +20,8 @@ def sync_fixtures(app=None):
fixture_files = sorted(os.listdir(frappe.get_app_path(app, "fixtures")))
for fname in fixture_files:
if fname.endswith(".json") or fname.endswith(".csv"):
import_doc(frappe.get_app_path(app, "fixtures", fname), ignore_links=True, overwrite=True)
import_doc(frappe.get_app_path(app, "fixtures", fname),
ignore_links=True, overwrite=True)

import_custom_scripts(app)



+ 2
- 2
frappe/website/website_generator.py Dosyayı Görüntüle

@@ -15,7 +15,7 @@ class WebsiteGenerator(Document):
website = frappe._dict(
page_title_field = "name"
)
def __init__(self, *args, **kwargs):
self.route = None
super(WebsiteGenerator, self).__init__(*args, **kwargs)
@@ -35,7 +35,7 @@ class WebsiteGenerator(Document):
self.route = self.make_route()

if self.route:
self.route = self.route.strip('/.')
self.route = self.route.strip('/.')[:140]

def make_route(self):
return self.scrub(self.get(self.website.page_title_field or "name"))


Yükleniyor…
İptal
Kaydet