تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
5055 أدوات العرض

I need to do some checking when submitting the form. (e.g. if the name of location is used or not)

where should I put the function and how do I get data from database to check the form?

الصورة الرمزية
إهمال
أفضل إجابة

Different ways to go about this. Most checks can be done on the fields themselves, in the form of on_change functions. Look up examples in the code.

If something can only be checked at the end, you might want to override the "create" method in your (inherited) object. This is called when you press the "Save" button for a record that does not yet exist. 

For records that already exist in the database, you need to override the "write" method on your object. This handles the writing the differences on the record you are working on.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
سبتمبر 19
13196
2
فبراير 16
6220
2
يناير 22
48321
0
يونيو 21
3069
0
يونيو 19
4325