File tree Expand file tree Collapse file tree 3 files changed +49
-2
lines changed
Expand file tree Collapse file tree 3 files changed +49
-2
lines changed Original file line number Diff line number Diff line change 1616 # Versions should comply with PEP440. For a discussion on single-sourcing
1717 # the version across setup.py and the project code, see
1818 # https://packaging.python.org/en/latest/single_source_version.html
19- version = '1.5.0 ' ,
19+ version = '1.5.1 ' ,
2020
2121 description = "FireO ORM is specifically designed for the Google's Firestore." ,
2222 long_description = long_description ,
Original file line number Diff line number Diff line change @@ -361,7 +361,15 @@ def order(self, field_name):
361361 if field_name [0 ] == '-' :
362362 order_direction = 'Desc'
363363 name = field_name [1 :] # Get the field name after dash(-) e.g -age name will be age
364- f_name = self .model ._meta .get_field (name ).db_column_name
364+
365+ # ISSUE # 155
366+ # If name is for nested field for MapField then there is not need to get field name
367+ # from model because there is no such field in model
368+ if "." in name :
369+ f_name = name
370+ else :
371+ f_name = self .model ._meta .get_field (name ).db_column_name
372+
365373 self .order_by .append ((f_name , order_direction ))
366374 return self
367375
Original file line number Diff line number Diff line change 1+ from fireo .models import Model
2+ from fireo .fields import TextField , NumberField , IDField
3+ import fireo
4+
5+
6+ def test_issue_155 ():
7+
8+ class Test (Model ):
9+ name = fo .fields .TextField ()
10+ score_data = fo .fields .MapField (default = {
11+ 'field1' : 0 ,
12+ 'field2' : 0
13+ })
14+
15+
16+ test1 = Test (name = 'test1' )
17+ test1 .save ()
18+ test1 .score_data ['field1' ] = 100
19+ test1 .score_data ['field2' ] = 300
20+ test1 .upsert ()
21+
22+ test2 = Test (name = 'test2' )
23+ test2 .save ()
24+ test2 .score_data ['field1' ] = 200
25+ test2 .score_data ['field2' ] = 200
26+ test2 .upsert ()
27+
28+ test3 = Test (name = 'test3' )
29+ test3 .save ()
30+ test3 .score_data ['field1' ] = 300
31+ test3 .score_data ['field2' ] = 100
32+ test3 .upsert ()
33+
34+ try :
35+ Test .collection .order ('score_data.field2' ).fetch ()
36+ assert True == True
37+ except Exception as e :
38+ assert True == False
39+
You can’t perform that action at this time.
0 commit comments