Procházet zdrojové kódy

[fix] don't unique text fields

version-14
Rushabh Mehta před 10 roky
rodič
revize
a0b27ae2d7
2 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. +1
    -1
      frappe/core/doctype/doctype/doctype.py
  2. +1
    -1
      frappe/model/db_schema.py

+ 1
- 1
frappe/core/doctype/doctype/doctype.py Zobrazit soubor

@@ -273,7 +273,7 @@ def validate_fields(meta):
frappe.throw(_("Precision should be between 1 and 6"))

def check_unique_and_text(d):
if d.unique and d.fieldtype in ("Text", "Long Text", "Small Text", "Code", "Text Editor"):
if getattr(d, "unique", False) and d.fieldtype in ("Text", "Long Text", "Small Text", "Code", "Text Editor"):
frappe.throw(_("Fieldtype {0} for {1} cannot be unique").format(d.fieldtype, d.label))

if d.search_index and d.fieldtype in ("Text", "Long Text", "Small Text", "Code", "Text Editor"):


+ 1
- 1
frappe/model/db_schema.py Zobrazit soubor

@@ -259,7 +259,7 @@ class DbColumn:
and not self.default.startswith(":") and column_def not in ('text', 'longtext'):
column_def += ' default "' + self.default.replace('"', '\"') + '"'

if self.unique and column_def not in ('text', 'longtext'):
if self.unique and (column_def not in ('text', 'longtext')):
column_def += ' unique'

return column_def


Načítá se…
Zrušit
Uložit