Fixed description react warning, better error message display

pull/209/head
Piero Toffanin 2017-06-15 13:07:52 -04:00
rodzic fa63913040
commit be9f396c68
3 zmienionych plików z 24 dodań i 3 usunięć

Wyświetl plik

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-15 17:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0002_task_auto_processing_node'),
]
operations = [
migrations.AlterField(
model_name='project',
name='description',
field=models.TextField(blank=True, default='', help_text='More in-depth description of the project'),
),
]

Wyświetl plik

@ -43,7 +43,7 @@ def assets_directory_path(taskId, projectId, filename):
class Project(models.Model):
owner = models.ForeignKey(User, on_delete=models.PROTECT, help_text="The person who created the project")
name = models.CharField(max_length=255, help_text="A label used to describe the project")
description = models.TextField(null=True, blank=True, help_text="More in-depth description of the project")
description = models.TextField(default="", blank=True, help_text="More in-depth description of the project")
created_at = models.DateTimeField(default=timezone.now, help_text="Creation date")
deleting = models.BooleanField(db_index=True, default=False, help_text="Whether this project has been marked for deletion. Projects that have running tasks need to wait for tasks to be properly cleaned up before they can be deleted.")

Wyświetl plik

@ -97,7 +97,7 @@ class FormDialog extends React.Component {
if (this.props.getFormData) formData = this.props.getFormData();
this.props.saveAction(formData).fail(e => {
this.setState({error: e.message || e.responseText || "Could not apply changes"});
this.setState({error: e.message || (e.responseJSON || {}).detail || e.responseText || "Could not apply changes"});
}).always(() => {
this.setState({saving: false});
}).done(() => {
@ -111,7 +111,8 @@ class FormDialog extends React.Component {
this.setState({deleting: true});
this.props.deleteAction()
.fail(e => {
this.setState({error: e.message || e.responseText || "Could not delete item", deleting: false});
console.log(e);
this.setState({error: e.message || (e.responseJSON || {}).detail || e.responseText || "Could not delete item", deleting: false});
});
}
}