Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assigned linked models can't be removed #16

Closed
evrenesat opened this issue Nov 3, 2015 · 0 comments
Closed

assigned linked models can't be removed #16

evrenesat opened this issue Nov 3, 2015 · 0 comments
Assignees
Labels
Milestone

Comments

@evrenesat
Copy link
Contributor

In [21]: w.personel
Out[21]: <Personel: foo 2323 (1234 | None)>

In [22]: w.personel = None

In [23]: w.save()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-23-9bf4ce6bbe5a> in <module>()
----> 1 w.save()

/home/evren/.virtualenvs/ulakbus/lib/python2.7/site-packages/pyoko/model.pyc in save(self)
    585
    586     def save(self):
--> 587         self.objects.save_model(self)
    588         for i in range(len(self.new_back_links)):
    589             if self.new_back_links:

/home/evren/.virtualenvs/ulakbus/lib/python2.7/site-packages/pyoko/db/base.pyc in save_model(self, model)
    218         if model:
    219             self.model = model
--> 220         clean_value = self.model.clean_value()
    221         if not self.model.is_in_db():
    222             self.model.key = None

/home/evren/.virtualenvs/ulakbus/lib/python2.7/site-packages/pyoko/model.pyc in clean_value(self)
    448         self._clean_field_value(dct)
    449         self._clean_node_value(dct)
--> 450         self._clean_linked_model_value(dct)
    451         return dct
    452

/home/evren/.virtualenvs/ulakbus/lib/python2.7/site-packages/pyoko/model.pyc in _clean_linked_model_value(self, dct)
    433         # get vales of linked models
    434         for name in self._linked_models:
--> 435             dct[un_camel_id(name)] = getattr(self, name).key
    436
    437     def clean_field_values(self):

AttributeError: 'NoneType' object has no attribute 'key'
@evrenesat evrenesat added the bug label Nov 3, 2015
@evrenesat evrenesat self-assigned this Nov 3, 2015
@evrenesat evrenesat added this to the 0.5 milestone Nov 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant