@@ -25,7 +25,7 @@ class Meta:
25
25
queryset = Union .objects .all ()
26
26
allowed_methods = ['get' , 'post' , 'put' , 'patch' ]
27
27
authorization = Authorization ()
28
- authentication = ApiKeyAuthentication ()
28
+ authentication = Authentication ()
29
29
filtering = {
30
30
'name' : ('exact' )
31
31
}
@@ -40,19 +40,19 @@ class LeagueResource(ModelResource):
40
40
class Meta :
41
41
queryset = League .objects .all ()
42
42
allowed_methods = ['get' , 'post' , 'put' ]
43
- authentication = ApiKeyAuthentication ()
43
+ authentication = Authentication ()
44
44
authorization = Authorization ()
45
45
46
46
47
47
class ClubResource (ModelResource ):
48
- union = fields .ForeignKey (UnionResource , 'union' )
48
+ union = fields .ForeignKey (UnionResource , 'union' , full = True )
49
49
# teams = fields.ToManyField('handball.api.TeamResource', 'teams')
50
50
51
51
class Meta :
52
52
queryset = Club .objects .all ()
53
53
allowed_methods = ['get' , 'post' , 'put' ]
54
54
authorization = Authorization ()
55
- authentication = ApiKeyAuthentication ()
55
+ authentication = Authentication ()
56
56
filtering = {
57
57
'union' : ALL_WITH_RELATIONS
58
58
}
@@ -72,13 +72,17 @@ class Meta:
72
72
queryset = Team .objects .all ()
73
73
allowed_methods = ['get' , 'post' , 'put' ]
74
74
authorization = Authorization ()
75
- authentication = ApiKeyAuthentication ()
75
+ authentication = Authentication ()
76
76
77
77
def obj_create (self , bundle , request = None , ** kwargs ):
78
78
# The user to create a team becomes its first manager (for lack of other people)
79
79
bundle .data ['managers' ] = ['/api/v1/person/' + str (request .user .get_profile ().id ) + '/' ]
80
80
return super (TeamResource , self ).obj_create (bundle , request )
81
81
82
+ def dehydrate (self , bundle ):
83
+ bundle .data ['display_name' ] = str (bundle .obj )
84
+ return bundle
85
+
82
86
83
87
class UserResource (ModelResource ):
84
88
person = fields .OneToOneField ('handball.api.PersonResource' , 'person' , full = True )
@@ -103,21 +107,25 @@ class Meta:
103
107
'last_name' : ['exact' ]
104
108
}
105
109
110
+ def dehydrate (self , bundle ):
111
+ bundle .data ['display_name' ] = str (bundle .obj )
112
+ return bundle
113
+
106
114
107
115
class GameTypeResource (ModelResource ):
108
116
class Meta :
109
117
queryset = GameType .objects .all ()
110
118
include_resource_uri = False
111
119
authorization = Authorization ()
112
- authentication = ApiKeyAuthentication ()
120
+ authentication = Authentication ()
113
121
114
122
115
123
class SiteResource (ModelResource ):
116
124
class Meta :
117
125
queryset = Site .objects .all ()
118
126
include_resource_uri = False
119
127
authorization = Authorization ()
120
- authentication = ApiKeyAuthentication ()
128
+ authentication = Authentication ()
121
129
122
130
123
131
class GameResource (ModelResource ):
@@ -137,7 +145,7 @@ class GameResource(ModelResource):
137
145
class Meta :
138
146
queryset = Game .objects .all ()
139
147
authorization = Authorization ()
140
- authentication = ApiKeyAuthentication ()
148
+ authentication = Authentication ()
141
149
142
150
143
151
class EventTypeResource (ModelResource ):
@@ -147,7 +155,7 @@ class Meta:
147
155
queryset = EventType .objects .all ()
148
156
include_resource_uri = False
149
157
authorization = Authorization ()
150
- authentication = ApiKeyAuthentication ()
158
+ authentication = Authentication ()
151
159
152
160
153
161
class EventResource (ModelResource ):
0 commit comments