Skip to content

Commit 0c37751

Browse files
author
Andres Vargas
committed
reorder the property set
1 parent 979e920 commit 0c37751

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

core/views.py

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ def mount(self, **kwargs):
5252
posts = posts.filter(param)
5353
return {
5454
'posts': list(posts.values("id", "title", "content")),
55-
'search': self.search # TODO: before mount we must put the new value of the search for updates_query_string works and work on the url
5655
}
5756

5857

livewire/views.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ def fill(
4848
def get_context(self):
4949
kwargs = self.__kwargs
5050
mount_result = {}
51+
# call mount if exists
52+
if hasattr(self, "mount") and callable(self.mount): # Livewire Compatility
53+
mount_result = self.mount(**kwargs)
54+
5155
params = get_vars(self)
5256
for property in params:
5357
mount_result[property] = getattr(self, property)
54-
if hasattr(self, "mount") and callable(self.mount): # Livewire Compatility
55-
mount_result = self.mount(**kwargs)
5658
return mount_result
5759

5860
def get_response(self): # TODO: chnge to use render method on component view
@@ -76,11 +78,12 @@ def get_response(self): # TODO: chnge to use render method on component view
7678
return json_response
7779

7880
def update_context(self, data_context):
81+
for key, value in data_context.items():
82+
setattr(self, key, value)
83+
7984
context = self.get_context()
8085
if data_context:
8186
context.update(data_context)
82-
for key, value in context.items():
83-
setattr(self, key, value)
8487
return context
8588

8689
def parser_payload(self, request):

0 commit comments

Comments
 (0)