Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Web - Open
drf-sqla
Commits
66e85eb1
Commit
66e85eb1
authored
Jul 13, 2015
by
Ashish
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated version, added release notes, fixed flake9 violations
parent
12a298af
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
9 deletions
+16
-9
HISTORY.rst
HISTORY.rst
+8
-1
djangorest_alchemy/fields.py
djangorest_alchemy/fields.py
+3
-2
djangorest_alchemy/tests/test_viewsets.py
djangorest_alchemy/tests/test_viewsets.py
+0
-1
djangorest_alchemy/tests/utils.py
djangorest_alchemy/tests/utils.py
+4
-4
setup.py
setup.py
+1
-1
No files found.
HISTORY.rst
View file @
66e85eb1
...
...
@@ -6,4 +6,11 @@ History
0.1.0 (2014-09-03)
++++++++++++++++++
* First release
\ No newline at end of file
* First release
0.2.0 (2015-07-13)
++++++++++++++++++
* Support for DRF 3.1
* Support for SQLAlchemy 0.9
* Support for Python 3
\ No newline at end of file
djangorest_alchemy/fields.py
View file @
66e85eb1
...
...
@@ -22,10 +22,11 @@ class AlchemyRelatedField(RelatedField):
pk_field
=
primary_key
(
value
.
__class__
)
pk_val
=
getattr
(
value
,
pk_field
,
None
)
return
(
'{parent}{model}s/{pk}/'
''
.
format
(
parent
=
self
.
parent_path
,
model
=
model_name
,
pk
=
pk_val
))
''
.
format
(
parent
=
self
.
parent_path
,
model
=
model_name
,
pk
=
pk_val
))
except
KeyNotFoundException
:
# Use actual model name
# Use actual model name
return
self
.
parent_path
+
model_name
+
's/'
...
...
djangorest_alchemy/tests/test_viewsets.py
View file @
66e85eb1
...
...
@@ -2,7 +2,6 @@
Integration test cases for AlchemyModelViewSet
Uses Django test client
'''
import
datetime
import
unittest
import
mock
...
...
djangorest_alchemy/tests/utils.py
View file @
66e85eb1
...
...
@@ -43,15 +43,15 @@ class DeclarativeModel(Base):
datetime
=
Column
(
DateTime
,
default
=
datetime
.
datetime
.
utcnow
)
floatfield
=
Column
(
Float
)
bigintfield
=
Column
(
BigInteger
)
child_model
=
relationship
(
ChildModel
,
uselist
=
False
,
primaryjoin
=
(
declarativemodel_id
==
ChildModel
.
parent_id
))
child_model
=
relationship
(
ChildModel
,
uselist
=
False
,
primaryjoin
=
(
declarativemodel_id
==
ChildModel
.
parent_id
))
#Multiple primary keys
#
Multiple primary keys
class
CompositeKeysModel
(
Base
):
__tablename__
=
'composite_model'
#This order of PK definition is important
#
This order of PK definition is important
pk1
=
Column
(
String
,
primary_key
=
True
)
pk2
=
Column
(
String
,
primary_key
=
True
)
compositekeysmodel_id
=
Column
(
INTEGER
,
primary_key
=
True
)
...
...
setup.py
View file @
66e85eb1
...
...
@@ -19,7 +19,7 @@ history = open('HISTORY.rst').read().replace('.. :changelog:', '')
setup
(
name
=
'djangorest-alchemy'
,
version
=
'0.
1.3
'
,
version
=
'0.
2.0
'
,
description
=
'Django REST Framework and SQLAlchemy integration'
,
long_description
=
readme
+
'
\n\n
'
+
history
,
author
=
'Ashish Gore'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment