@step(((STEP_PREFIX + '([A-Z][a-z0-9_ ]*) with ([a-z]+) "([^"]*)"') + ' has(?: an?)? ([A-Z][a-z0-9_ ]*) in the database:'))
def create_models_for_relation(step, rel_model_name, rel_key, rel_value, model):
 lookup = {rel_key: rel_value}
 rel_model = get_model(rel_model_name).objects.get(**lookup)
 for hash_ in step.hashes:
  hash_[('%s' % rel_model_name)] = rel_model
 write_models_generic(step, model)

@ step ( ( ( STEP_PREFIX + '([A-Z][a-z0-9_ ]*) with ([a-z]+) "([^"]*)"' ) + ' has(?: an?)? ([A-Z][a-z0-9_ ]*) in the database:' ) ) def create_models_for_relation ( step , rel_model_name , rel_key , rel_value , model ) : lookup = { rel_key : rel_value } rel_model = get_model ( rel_model_name ) . objects . get ( ** lookup ) for hash_ in step . hashes : hash_ [ ( '%s' % rel_model_name ) ] = rel_model write_models_generic ( step , model )
and project with name "ball project" has goals in the database: | description | | to have fun playing with balls of twine | .