Skip to content

Duplicate warning for categories #76

@jsbroks

Description

@jsbroks

Add toastr for creation of category if it already exists:

annotator_flask | Traceback (most recent call last):
annotator_flask |   File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
annotator_flask |     rv = self.dispatch_request()
annotator_flask |   File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
annotator_flask |     return self.view_functions[rule.endpoint](**req.view_args)
annotator_flask |   File "/usr/local/lib/python3.6/site-packages/flask_restplus/api.py", line 325, in wrapper
annotator_flask |     resp = resource(*args, **kwargs)
annotator_flask |   File "/usr/local/lib/python3.6/site-packages/flask/views.py", line 88, in view
annotator_flask |     return self.dispatch_request(*args, **kwargs)
annotator_flask |   File "/usr/local/lib/python3.6/site-packages/flask_restplus/resource.py", line 44, in dispatch_request
annotator_flask |     resp = meth(*args, **kwargs)
annotator_flask |   File "/usr/local/lib/python3.6/site-packages/flask_login/utils.py", line 261, in decorated_view
annotator_flask |     return func(*args, **kwargs)
annotator_flask |   File "/workspace/app/api/categories.py", line 48, in post
annotator_flask |     category.save()
annotator_flask |   File "/workspace/app/models.py", line 301, in save
annotator_flask |     return super(CategoryModel, self).save(*args, **kwargs)
annotator_flask |   File "/usr/local/lib/python3.6/site-packages/mongoengine/document.py", line 405, in save
annotator_flask |     raise NotUniqueError(message % six.text_type(err))
annotator_flask | mongoengine.errors.NotUniqueError: Tried to save duplicate unique keys (E11000 duplicate key error collection: flask.category_model index: name_1 dup key: { : "123" })

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions