Orack
is there some special function for sync in djagngo rest framweork
Orack
like upload all files which are missing on server but present on the client
Anonymous
What?
I mean , I want to attach a cutomsise map and want to give Functioning like swiggy through Django
Mirco
It's up to you
Orack
Nope , nothing built-in
how should i proceed towards that
Orack
right now how it works is
Mirco
Please write into one message
Orack
1 12 123 so 1,1,1,2,2,3 ie for each file upload it reuploads old uploads too
Oleg
1 12 123 so 1,1,1,2,2,3 ie for each file upload it reuploads old uploads too
Make users upload each file one by one, so they won't have to upload them all at once
Orack
Maybe maintain a log of files
but say after 100 files wont that be a slow process?
Anonymous
No
Anonymous
Maintain a json files... Which will keep track the changes and addition of files and upload according to it
Orack
Make users upload each file one by one, so they won't have to upload them all at once
if user uploads "1.jpg " today clientlist=("1.jpg") then tommorow "2.jpg" clientlist=("1.jpg", "2.jpg") #1 and 2 uploaded again then day after "3.jpg" clientlist = ("1.jpg", "2.jpg", "3.jpg") # 1 2 3 all uploaded again server has 1 1 1 2 2 3 and suppose I dont upload whole clientlist, but what if there is Internet connectivity issue and 2.jpg fails to be uploaded then server never gets that
Anonymous
No
Vahe
Hey, guys does anybody know how can I send list of json serialized objects in the HttpResponse? Now I have code like this: return HttpResponse(my_object, content_type="application/json") So I want to have list of objects instead of my_object. Any ideas?
Mirco
any sample code ?
You need to implement something like rsync For example rsync copies just files that aren't already copied into the destination
Vahe
Serialize a list of objects instead of a single object
Do you have any examples? I have tried but it didn't work
Vahe
Use JsonResponse
Will look through now
Mirco
Will look through now
Or if it's an API, use Django Rest Framework
Orack
You need to implement something like rsync For example rsync copies just files that aren't already copied into the destination
yes, but i need it in javabased client, i was hoping for some module like localhost/sync post(1,2,3,4) it should check if 1 is available, if yes dont upload
Ori
Do you have any examples? I have tried but it didn't work
my_list = json.dumps([ {'a': 1, 'b': 2}, {'a': 3, 'b': 4}, ]) JsonResponse would be a better idea though.
Vahe
Thanks a lot guys, will try them now
Doragonsureiyā
Didn't know about this, thanks
You're welcome! 😊
Ori
You're welcome! 😊
Aw, doragon has at least one wholesome !command
Orack
Nope, you need to implement the logic
when we do myserializer.save() is there anything to not to save if some id exists ?
Mirco
You can always write a method to clean fields and do your checks before saving
Orack
eh spam ?
Mirco
eh spam ?
You can ban spam too 😊
Orack
You can always write a method to clean fields and do your checks before saving
this needs to be added in serializers.py or views.py ?
Shubham
Hello guys caught up with an error not getting how to resolve
Shubham
https://github.com/shubham1507/school/blob/trial/users/urls.py
Shubham
Could not resolve URL for hyperlinked relationship using view name "user-detail". You may have failed to include the related model in your API, or incorrectly configured the lookup_field attribute on this field.
Shubham
on click users api's
Shubham
https://github.com/shubham1507/school/blob/trial/users/views.py
Shubham
https://github.com/shubham1507/school/blob/trial/users/models.py
Mirco
And serializers
Shubham
https://github.com/shubham1507/school/blob/trial/users/serializers.py
Mirco
That's not the problem but variables like Teacherprofile are not following PEP standard
Mirco
Use snake_case instead
Shubham
okay
Shubham
let me change and report @pyflare
Shubham
thanks
Mirco
Into your views context makes no sense
Mirco
context is a dict , so you need to use key:value to give it a sense
Mirco
And why TeacherSerializer is Hyperlinked and Student one not ?
Mirco
It makes more sense if into User serializer you will have a boolean that tells you if it's a teacher or not
Mirco
it need to improvised
You should have a link to user into Student and Teacher serializers
Ghorz
like localhost/upload for bob user should upload files in ./bob/ location, and for user2 in ./user2
yes, set in models image = models.ImageField(upload_to='users/profile/users/%Y/%m/%d', blank=True) change user to reflect userobject
Ghorz
okay
Ghorz
welcome
Orack
👍
Hamouda
Hi everyone
Hamouda
i need your help in something
Hamouda
am getting that error of "NOT NULL constraint failed: Main_profile.user_id"
Hamouda
i got that when i try to update my user profile
Hamouda
its appear when i try to save the profile form
Hamouda
https://dpaste.de/46Fn
xarala221
Best server for django.??
The server depend on your needs. I always host my Django in VPS hosting, digital ocean has great plan, you can also check linode, python anywhere etc... Don't use web hosting
Anonymous
Hello
Anonymous
No