Skip to content

Commit

Permalink
improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
francescortiz committed Jun 17, 2013
1 parent 37e64d7 commit 1f7b614
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/compositekey/db/models/fields/wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def get_composite_pk(fields, name="pk"):
cache_name="_composite_%s_cache" % name
def _get(obj):
# cache, if change the values you can yet identify thre real record
# TODO FRANKI: Si uno de los campos es un foreignkey no podemos hacer la busqueda relacional sobre None, así que try/except
# If one of the fields is a foreignkey we cannot make the relational search over None, so try/except
try:
if not hasattr(obj, cache_name):
setattr(obj, cache_name, assemble_pk(*[f.get_prep_value(getattr(obj, f.name)) for f in fields]))
Expand All @@ -49,6 +49,7 @@ def _set(obj, value):
if len(values) <> len(fields):
values = [None for _ in fields]
for field, val in zip(fields, values):
# For foreignkeys we have to get the related object
try:
val = field.rel.to(pk=val)
except AttributeError:
Expand Down
2 changes: 1 addition & 1 deletion src/compositekey/db/models/sql/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def make_atom(self, field_sql, extra, params, lookup_type, value_annot, qn, conn
class MultiColumn(object):
def __init__(self, fields):
self.fields = fields
# TODO FRANKI: Hemos puesto que si no encuentra "column" asigne "db_column"
# Use "db_column" in case "column" is not found
self.columns = [getattr(f, 'column', f.db_column) for f in fields]

def as_sql(self, qn, connection):
Expand Down

0 comments on commit 1f7b614

Please sign in to comment.