Manish
ok
Ashish
Hi
Mr. Rude
Hi
Manish
hey
Mirco
Hi
hi ya
Anonymous
Anonymous
inchidi
english only please
-
Hi. Drf. I have modelserialize for django user, and when I do path request with same username, I got validation error, for unique field. How to ignore this in patrial update if username have not change?
-
@Inchidi class UserSerializer(ModelSerializer): class Meta: model = User fields = ('pk', 'username', 'first_name', 'last_name', 'middle_name', 'email', 'password') extra_kwargs = { 'password': { 'write_only': True, }, } class EmployeeSerializer(ModelSerializer): user = UserSerializer() class Meta: model = Employee fields = ('user', 'birth_date', 'address', 'passport_serial', 'passport_number', 'identifing_code', 'phone_corp', 'phone_private', 'phone_ate', 'department', 'pk')
-
@Inchidi I have smthing like profile, I want to do udpate of it, but when I send same username, I have error with unique validation. I know that I need change validators of username field, but I need only to off it in patch request ( when partial = True)
Luis
I remember you can write create and update method
Luis
Please, read rest framework docs
-
@Inchidi or this dont wotk
-
@Inchidi and first too
inchidi
then the first one
-
@Inchidi https://medium.com/django-rest-framework/dealing-with-unique-constraints-in-nested-serializers-dade33b831d9
inchidi
why it doesnt work?
-
@Inchidi coz, I need remove validators of field
-
@Inchidi but its not what I wanted, anyway... I need just if username is same as in instance, pass it and dont try even to change
-
@Inchidi mb I will write my own validator =\ Wanted more explicit solution.
-
I mean if partial for serializer. I make patch request within ModelViewset ( he makes partial=True for serializer). And here, I donw want to validate it...
inchidi
I mean if partial for serializer. I make patch request within ModelViewset ( he makes partial=True for serializer). And here, I donw want to validate it...
🤔 iirc if its update then you dont pass data to your model serializer but you pass instance of object that will be updated. its weird if the serializer raise ValidationError when you pass instance
inchidi
at this this point i guess you are using your serializer in the wrong way
-
hm, so, I just wil not send this field if it have not changed
Сергей
Hi, can i rollback last changes in sqlite3 by time?
Anonymous
https://dpaste.de/6bDA
inchidi
Hi, can i rollback last changes in sqlite3 by time?
by time like x minutes or by certain tasks
Сергей
If I want rallback on 5 hours, how can I do it?
Anonymous
https://dpaste.de/6bDA
Any mistake on the above code... Can't validate the form.. Why
Сергей
Manish
@sdkca986 remove 1 tab space from args and return render which is after else block in line 13 and 14
Manish
@sdkca986 https://dpaste.de/o2Qs your fix
Anonymous
when i submit the form ,form.is_valid() is false so i can't save the
Anonymous
user
N S
Can someone give me a guide to deploy django project using nginx and gunicorn
Rajjix
tutorials are all out there but if you’re willing to give me access i’ll do jt for you
Anders (izzno / gooood) 🇳🇴
Anders (izzno / gooood) 🇳🇴
You might know this but i was so impressed with how easy this was today...
Anders (izzno / gooood) 🇳🇴
Build an api and populate a db in less than an hour... I wish i knew django years ago...
Rajjix
check out faker it’s great in filling up your db with data
Anders (izzno / gooood) 🇳🇴
check out faker it’s great in filling up your db with data
The data is usually specific, so writing a simple python script is usually good enough. Unless faker supports many formats that is?
Rajjix
It does it’s a full library made just for that you just pick what kind of data from username to phone mumbers in many different formats and makes your data look somehow real
Anders (izzno / gooood) 🇳🇴
Ill have a look thanks.
Anders (izzno / gooood) 🇳🇴
(By formats i mean i can get the data in different formats which needs to be imported in a db, xls, csf, csv .... etc
Rajjix
https://github.com/joke2k/faker
Anders (izzno / gooood) 🇳🇴
https://github.com/joke2k/faker
haha, not excatly what i was looking for but still very nice ;)
Anders (izzno / gooood) 🇳🇴
problem: I have to create an api for a php developer on windows and i have a few options and was wondering if you can one up me. Option 1: Create a dockerimage and ask him to install and learn docker Option 2: Create a Hyper-V image and ask him to run that Option 3: Create a VirtualBox and ask him to run that The idea is that he utilizes my api/db. Any easier suggestions for a windows dev env? (And no, labserver, lxc is not an option)
Anders (izzno / gooood) 🇳🇴
I would ask him to quit using php, if that's not an option, I'd go with the docker one
Yes, that's what I said in the first place, but this is what he knows and this is reality at the moment... Thanks for answering.
Rajjix
Good man 😀
The Nginx proxy_pass worked fine, only problem my api still had to be part of my url, just now when checking my browser console, i realized CORS was the initial problem not allowing me to do GET requests, django-cors-headers solved it
Anonymous
Hello. Started to learn Django. Need help with putting a result of linux command ls -l to django template. How can I do it ? please see the code here https://dpaste.de/9TTo
Anonymous
{{ cmd }} this helped but now need to convert somehow to human readable format
Anonymous
now I have <subprocess.Popen object at 0x7fed0d6b85f8> in html
George
Maybe you could stringify it
George
Str(cmd)
Anonymous
Hi, Someone have this ebook to share? 🙂 https://djangoforbeginners.com/
Rajjix
Hi, Someone have this ebook to share? 🙂 https://djangoforbeginners.com/
i have read some of his articles before, i'm sure you'll find most of what's in that book here
Rajjix
https://wsvincent.com/
Anonymous
like that maybe ? I tried several ways but doesn't work https://dpaste.de/83qZ
Anonymous
stringify is not defined
Vladyslav 🇺🇦🇪🇺
Anybody know, how i can send messages from telegram bot to my channel with inline buttons?
Anonymous
thanks George, I'll try to figure this out
Rajjix
rez = cmd.communicate()
George
rez = cmd.communicate()
Yeah, i remember now, i didnt know rhe actual function
George
I did once to communicate between bash scripts with the name of processes to kill for example