group_name "gt355g5tg"
group_description "5tg4g5tgtgv"
group_image "/base/static/base/static/images/git_NmsP5rN.png"
group_music "/base/static/base/static/music/git_zObr3eT.png"
salary 0.3
trainer
first_name "sudo"
second_name "rootovich"
last_name "admin"
trainer_phone_number "+380939394959"
monday_time "00:00"
tuesday_time "00:00"
wednesday_time "00:00"
thursday_time "00:00"
friday_time "00:00"
saturday_time "00:00"
sunday_time "00:00"
images_for_slider
0 1
1 2
2 3
3 4
...atic/images/', '
- это я просто убирал лишнее для вопроса. Вот код сериалайзераclass GroupSerializer(serializers.ModelSerializer):
trainer = TrainerSerializer()
class Meta:
model = Group
fields = (
"group_name",
"group_description",
"group_image",
"group_music",
"salary",
'trainer',
'monday_time',
'tuesday_time',
'wednesday_time',
'thursday_time',
'friday_time',
'saturday_time',
'sunday_time',
'images_for_slider',
)
def create(self, validated_data):
"""
Create and return new 'Group'
:param validated_data:
:return:
"""
return Group.objects.create(**validated_data)
def update(self, instance, validated_data):
"""
Update and return an existing 'Group' instance, give the validated data
:param instance:
:param validated_data:
:return:
"""
instance.group_name = validated_data.get('group_name', instance.group_name)
instance.group_description = validated_data.get('group_description', instance.group_description)
instance.group_image = validated_data.get('group_image', instance.group_image)
instance.images_for_slider = validated_data.get('images_for_slider', instance.images_for_slider)
instance.group_music = validated_data.get('group_music', instance.group_music)
instance.salary = validated_data.get('salary', instance.salary)
instance.trainer = validated_data.get('trainer', instance.trainer)
instance.save()
return instance
constructor() {
super();
this.state = {
data: {},
trainer: [],
//diagram: this.chartData(),
};
}
chartData = () => {
return {
labels: ['Boys', 'Girls'],
datasets: [
{
label: 'My First dataset',
fillColor: 'rgba(220,220,220,0.2)',
strokeColor: 'rgba(220,220,220,1)',
pointColor: 'rgba(220,220,220,1)',
pointStrokeColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStroke: 'rgba(220,220,220,1)',
data: [this.state.data.boys, this.state.data.girls],
},
]
};
};
<div>
<Doughnut data={this.chartData()}
width="100" height="50"/>
</div>
<table class="table table-striped">
<tr><td class="col-md-1">Done</td></tr>
<% @tasks.each do |task| %>
<tr>
<% if task.done %>
<% if task.user_id == current_user.id %>
<td><%= check_box_tag "cb_tasks[]", task.id %>
<%= link_to task.title, task, class: "btn btn-info" %></td>
<td><%= link_to 'Edit', edit_task_path(task), class: "btn btn-primary" %>
<%= link_to 'Mark as to do', change_to_todo_path(task.id), class: "btn btn-success" %>
<%= link_to 'Destroy', task, class: "btn btn-danger", method: :delete, data: {confirm: 'Are you sure?'} %></td>
<% end %>
<% end %>
</tr>
<% end %>
</table>