Explorar el Código

[fix] don't unique text fields

version-14
Rushabh Mehta hace 10 años
padre
commit
a0b27ae2d7
Se han modificado 2 ficheros con 2 adiciones y 2 borrados
  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 Ver fichero

@@ -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 Ver fichero

@@ -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


Cargando…
Cancelar
Guardar