Ignore ignored JSON tags

Signed-off-by: Etzelia <etzelia@hotmail.com>
model_post
Etzelia 2019-11-24 15:19:49 -06:00
parent 7ad5a3a5d6
commit c410001f8d
No known key found for this signature in database
GPG Key ID: 708511AE7ABC5314
1 changed files with 4 additions and 1 deletions

View File

@ -41,7 +41,10 @@ func (q *Model) Values(i interface{}) url.Values {
iVal := reflect.ValueOf(i).Elem() iVal := reflect.ValueOf(i).Elem()
typ := iVal.Type() typ := iVal.Type()
for i := 0; i < iVal.NumField(); i++ { for i := 0; i < iVal.NumField(); i++ {
values.Set(strings.ToLower(typ.Field(i).Tag.Get("json")), PyConvert(iVal.Field(i))) tag := typ.Field(i).Tag.Get("json")
if tag != "-" {
values.Set(strings.ToLower(tag), PyConvert(iVal.Field(i)))
}
} }
return values return values
} }