Answer the question
In order to leave comments, you need to log in
How to upload an image using Django rest framework?
Hello!
Unable to update values in post, error occurs:
img_post: ["Uploaded file is not a valid file."]
class PostsSerializer(TaggitSerializer, serializers.ModelSerializer):
tags = TagListSerializerField()
views_sum = serializers.IntegerField(source='views_post.views_sum')
rating = serializers.IntegerField(source='views_post.rating')
def save(self, **kwargs):
obj, views = ViewsPost.objects.get_or_create(post_views=self.instance.id)
vd_views = self.validated_data.get('views_post')
obj.views_sum = vd_views['views_sum']
obj.rating = vd_views['rating']
obj.save()
class Meta:
model = Posts
fields = ('id', 'title', 'category', 'img_post', 'date',
'preview', 'post_text', 'approved', 'slug', 'tags', 'views_sum', 'rating')
class PostsViewSet(viewsets.ModelViewSet):
serializer_class = PostsSerializer
queryset = Posts.objects.filter(approved=True)
lookup_field = 'slug'
filter_backends = [DjangoFilterBackend]
filterset_fields = ['category__slug']
async submitRating(rat) {
let formData = new FormData();
for (let data in this.post) {
formData.append(data, this.post[data]);
}
let dataPost = this.post;
dataPost.rating = +dataPost.rating + rat;
try {
let response = await this.$axios.$put('/posts/' + this.post.slug + '/', dataPost);
} catch (e) {
console.log(e.toString())
}
}
Answer the question
In order to leave comments, you need to log in
Thanks everyone for the replies.
I decided to check the indicators in Hades, it turned out that the percentage is heated by 80% and because of this, the percentage went into throttling.
I didn’t take out the cooler, because I took the percentage for the old processor, namely 4330, although I don’t know why, because before everything was ok. In general, I changed the cooler and everything was fine.
Well, rejoice that the card draws graphics better than the processor logic.
You can run a hairy donut, then the processor will idle, and the vidyuha will plow and warm up.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question