Skip to content

Commit a164acb

Browse files
author
khz
committed
relations are updated now online
1 parent 001a9db commit a164acb

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

pythononwheels/start/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"id_pattern" : "[0-9\-a-zA-Z]+", # the regex used to math IDs in URLs (uuid in this case)
4747
"list_separator" : ",",
4848
"date_format" : "%Y-%m-%dT%H:%M:%S",
49-
"internal_fields" : ["created_at", "last_updated", "id"], # these cannot be changed in the scaffolded views
49+
"internal_fields" : ["created_at", "last_updated", "id"], # these are hidden in the scaffolded views
5050
"default_rest_route": "list",
5151
"list_separator" : " "
5252
#"environment" : "development" # set the current environment (also see the db section)

pythononwheels/start/models/sql/basemodel.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,18 +357,21 @@ def find(self,*criterion):
357357
Example: model.find(ModelClass.attribute == "someval")
358358
p.find(Post.title=="first")
359359
"""
360+
self.session.expire_all()
360361
return session.query(self.__class__).filter(*criterion)
361362

362363
def find_by_id(self, id):
363364
"""
364365
Searches the DB by id
365366
"""
367+
self.session.expire_all()
366368
return session.query(self.__class__).get(id)
367369

368370
def find_all(self, *criterion, raw=False, limit=None, offset=None):
369371
"""
370372
Searches the DB (Parameters: limit, offset
371373
"""
374+
self.session.expire_all()
372375
if raw:
373376
return session.query(self.__class__).filter(*criterion).limit(limit).offset(offset)
374377
res = session.query(self.__class__).filter(*criterion).limit(limit).offset(offset).all()
@@ -377,18 +380,20 @@ def find_all(self, *criterion, raw=False, limit=None, offset=None):
377380
def get_all(self):
378381
""" returns all elements without any filters"""
379382
return self.find_all()
380-
383+
381384
def find_one(self, *criterion):
382385
"""
383386
returns one or none
384387
"""
388+
self.session.expire_all()
385389
res = session.query(self.__class__).filter(*criterion).one()
386390
return res
387391

388392
def find_first(self, *criterion):
389393
"""
390394
return the first match (if any)
391395
"""
396+
self.session.expire_all()
392397
res = session.query(self.__class__).filter(*criterion).first()
393398
return res
394399

pythononwheels/start/stubs/scaffold_show_view.bs4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<hr>
3737

3838
<a href="/{{base_route_rest}}" class="btn btn-primary">Back to {{handler_name}}.list</a>
39+
<a href='/{{base_route_rest}}/{{getattr(data, "id")}}/edit'class="btn btn-warning">Edit</a>
3940

4041
<hr>
4142
<h2>Raw: </h2>

pythononwheels/start/views/base.bs4

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<link href="{{ static_url("css/justified-nav.css") }}" rel="stylesheet">
2424
<link href="{{ static_url("css/prism.css") }}" rel="stylesheet">
2525
<link href="{{ static_url("css/pow.css") }}" rel="stylesheet">
26-
26+
<link rel="stylesheet" href="https://rawgit.com/enyo/dropzone/master/dist/dropzone.css">
2727

2828
{% block css %}
2929

@@ -50,5 +50,6 @@
5050

5151
<script src="{{ static_url("js/tether.min.js") }}"></script>
5252
<script src="{{ static_url("js/bootstrap.min.js") }}"></script>
53+
<script src="https://rawgit.com/enyo/dropzone/master/dist/dropzone.js"></script>
5354
</body>
5455
</html>

0 commit comments

Comments
 (0)