Code9
does capitalization matter
Karim Norman
Istartswith
Karim Norman
I use istartswith
Django Bot
>> Links - Quickstart: Compose and Django | Docker Documentation
Karim Norman
so, to achieve what I needed in the endpoint I had to pass a param to the serializer and filter the related fields.
Karim Norman
this work
Django Bot
>> Blogs - Equivalents in Python and JavaScript. Part 2
inchidi
https://stackoverflow.com/a/50141290/3925477
Maz
Has anyone done a migration from Sqlite to Postgres before? For me it usually goes perfect...but today I'm getting a funny error.
Maz
The dumped data is only kilobytes in size...
Maz
The steps I followed are: python2 manage.py dumpdata > datadump.json Changed settings on backend to postgres Connected to Postgres database. python2 manage.py migrate (successful) python2 manage.py shell >>>from django.contrib.contenttypes.models import ContentType >>>ContentType.objects.all().delete() >>>quit() python2 manage.py loaddata datadump.json
Maz
The dump is going through, but the datadump.json only has schema and permission data, nothing else.
inchidi
The dump is going through, but the datadump.json only has schema and permission data, nothing else.
Note that dumpdata uses the default manager on the model for selecting the records to dump. If you’re using a custom manager as the default manager and it filters some of the available records, not all of the objects will be dumped.[source]
Maz
Nice, lemme check this out,
inchidi
you can try py manage.py dumpdata app_label >datadump.json also
inchidi
or --all
Maz
How about dumpdata --all > datadump.json
inchidi
just try it maybe, nothing to lose
Maz
Because if I start specifying apps I will have to specify all the apps in the project, right?
inchidi
open datadump.json and check what dumped first
inchidi
searching for the model name should work
Maz
As you can see, doing an 'll' on the datadumo shows it's only 14kb
Rohan
Open it
inchidi
open and check it
Maz
Opened it with a text editor and it only contains schema info and permissions data.
inchidi
have you try searching "yourmodelname"?
inchidi
use dpaste.de
Maz
use dpaste.de
No need...it's just a bunch of schema information. No real data.
inchidi
what model with most data you have?
Maz
what model with most data you have?
The model with most data is one called Student. I've done a 'dumpdata --all'
Maz
It only dumps schema info and permissions.
Maz
at least make me believe it
Lol.. This is business, man. I don't play around with this time. Believe me I've checked and rechecked.
inchidi
Student using custom manager?
inchidi
Lol.. This is business, man. I don't play around with this time. Believe me I've checked and rechecked.
no, i mean do: vim datadump.json /student<enter> and tell me how many found (by typing n)
inchidi
Yes
ah, then what filter that custom manager did?
Maz
results *
Maz
It's simply not picking the Student table.
Django Bot
>> Links - Modern Django: Part 1: Setting up Django and React — v1k45
Anonymous
ah, then what filter that custom manager did?
can i send pastebin link here for my codes?
Leo
But you’re free to do so
Anonymous
I hope you can 🤔
i sent it but i think bot deleted my message :)
inchidi
Leo
Well, yeah, there’s nothing I can do about that :/
inchidi
i'll increase the treshold
Anonymous
is it okey that i put some space ?
inchidi
Well, yeah, there’s nothing I can do about that :/
actually you can access combot config for this group. feel free when you need change something
inchidi
is it okey that i put some space ?
you can just post it. it was probably because you send msgs too fast
Anonymous
you can just post it. it was probably because you send msgs too fast
🤔 i didn't think so i am not fast enough like this
inchidi
🤔 i didn't think so i am not fast enough like this
ah you are new member. please try again
Anonymous
ah you are new member. please try again
can bot remove somebody? i think i was removed
Anonymous
I wrote this model and a function that can provide path for fields: https://pastebin.com/eyZsU36g I need to gather my folder together like this: assume my first field file name is like this : myapp.py so my path will like this: /media/username/myapp/myapp.py /media/username/myapp2/myapp2.py /media/username/myapp3/myapp3.py but it need path like this: /media/username/myapp/myapp.py /media/username/myapp/myapp2.py /media/username/myapp/myapp3.py what is your point of view about it?
Anonymous
ah you are new member. please try again
Bot will remove / something i guess too :)
inchidi
Bot will remove / something i guess too :)
turned off restriction for new members, you should able to post link now
inchidi
so, its nice thing to do
Django Bot
>> Links - NewbieMistakes – Django
Anonymous
so, its nice thing to do
☺️ thank you but i can't find solution for my problem do you understand my question?
Anonymous
nope, mind to elaborate?
my problem is that i can't save second , third , ... files in first folder , i mean in myapp folder that same with first file field myapp.py
inchidi
Language: py3 Source: s = 'myapp3.py' result = ''.join([i for i in s.split('.')[0] if not i.isdigit()]) print(result) Result: myapp
Anonymous
so basically you want to remove the numbering in your file name?
no it's just e sample for understanding my problem they name can be anything like mark.py joe.py anything.py but all of them should be like this /username/mark/mark.py /username/mark/joe.py /username/mark/anything.py
Anonymous
why joe.py also inside mark directory?
because the are related with mark like his avatar , his program, his notes and ...
inchidi
then why not just put inside username directory?
inchidi
each user have each username right?
Anonymous
yes i think is better to manage and get some statistical info for admins that use os for managing, 😐 i think i have no excuse for it just for clearing i think
inchidi
yes i think is better to manage and get some statistical info for admins that use os for managing, 😐 i think i have no excuse for it just for clearing i think
except if you want each user have "projects" and user can add files for projects. then using /username/project_name/file.py format make sense
Anonymous
except if you want each user have "projects" and user can add files for projects. then using /username/project_name/file.py format make sense
yes i want do this so i need to get project_name first then save my files in, how can i do this with model? can i use something like my code?
inchidi
yes i want do this so i need to get project_name first then save my files in, how can i do this with model? can i use something like my code?
yes you will do exactly like that. just replacing second param of ''.format() become its project name
Anonymous
yes you will do exactly like that. just replacing second param of ''.format() become its project name
thank you very much :) 🌹 so helpful talk and sorry for my bad english it's not my native language