Aleksandr
hello! I am looking for a job. Who have any vacancies?
Aleksandr
please do not ban
Aleksandr
i just wanna work
Django Bot
>> Blogs - DJANGO 2.0 - Django Login/Logout Tutorial - Nested resources with Django REST Framework >> Links - (5) Django + ReactJS - YouTube
Luis
i just wanna work
You can search here
Luis
There are many job offers
Aleksandr
Search in this channel?
Aleksandr
=)
Aleksandr
ok thanks =)
Anonymous
/stat@combot
Combot
combot.org/chat/-1001146340312
Anonymous
Please what's the command to create a python virtual environment and inherit the global site packages from python site packages in a system....
Aleksandr
Samuel, you can insatal conda
Aleksandr
and simply use conda create -n New_ENV
Aleksandr
after it : source activate New_ENV
Anonymous
Thanks @JimmySan
Anonymous
Sorry am kinda new to python, what's conda?
Aleksandr
conda it is for virtual invironments
Jimmies San
Sorry am kinda new to python, what's conda?
a wrapper that helps you to create venv for a lot of languages [Python, R, Ruby, Lua, Scala, Java, JavaScript, C/ C++, FORTRAN ... ]
Aleksandr
https://conda.io/docs/
Aleksandr
conda is simple
Aleksandr
and agile
Anonymous
I started learning django/python few weeks back... Am kinda getting some concepts in it and web development in general... A friend suggested I should use TDD (test driven development) approach for building apps, he's a JS guy... Luckily django encourages Testing for apps but what I don't seem to understand is that, how does one know what to test when building an app.Is there like any module that can suggest some part of our code that should be tested and others that shouldn't
Anonymous
?
inchidi
yeah, @DjangoRSSbot usually post new jobs from https://www.djangojobs.net/jobs/
inchidi
🤔 is it necessary or you preferred this solution? i mean, is it okey to make an app just for models?
of course, lots of django packages do that, but usually they just give you migrations file instead the models
Aleksandr
ok. thanks
Django Bot
>> Links - Django
Someone
Hi, what is the best way to save a model as draft? In UI there will be 2 buttons submit and save. When clicked on save data in model should be in draft state, when clicked on submit.. it should be in completed state and should not allow user to edit the data
Django Bot
>> Links - S3SQLite - A Serverless Relational Database
mλdcodez
The view blog.views.post_share didn't return an HttpResponse object. It returned None instead. I'm following the book called django by example.. I'm not getting why this error happened.
mλdcodez
def post_share(request, post_id): # Retrieve Post by id post = get_object_or_404(Post, id = post_id, status='published') sent = False if request.method == 'POST': # Form was submitted form = EmailPostForm(request.POST) if form.is_valid(): #form fields passed validation cd = form.cleaned_data # ...send email post_url = request.build_absolute_uri(post.get_absolute_url()) # check for uri instead of url. subject = '{} ({}) recommends you reading "{}"'.format(cd['email'], post.title) message = 'Read "{}" at {}\n\n{}\'s comments: {}'.format(post.title, post.url, cd['name'], cd['comments']) send_mail(subject, message, 'admin@myblog.com', [cd['to']]) # ? admin@myblog.com/ sent = True else: form = EmailPostForm() return render(request, 'blog/post/share.html', {'post': post, 'form': form, 'sent': sent})
mλdcodez
this is the method...
mλdcodez
sorry, do i share via paste bin or something?
mλdcodez
https://pastebin.com/iFhBBJSt
Django Bot
>> Links - Tutorial: Django REST with React (Django 2.0) - Tracking User Login Activity in Django Rest Framework: JWT Authentication
mλdcodez
Oh. Thanks 😊😊😊😊
mλdcodez
after removing one tab local variable 'form' referenced before assignment
mλdcodez
also says, again line 33
mλdcodez
oh, i think, an extra tab at line 31 as well,.. removed. and testing.
mλdcodez
it works. :)
mλdcodez
Thanks :)
mλdcodez
tuple index out of range Line 27 subject = '{} ({}) recommends you reading "{}"'.format(cd['email'], post.title)
mλdcodez
https://pastebin.com/iFhBBJSt
at line 26, is it okay, as its written uri instead of url in example.
inchidi
Language: python3 Source: cd= {'email':'foo@bar.com'} subject = '{} ({}) recommends you reading "{}"'.format(cd['email'], 'username', 'post.title') print(subject) Result: foo@bar.com (username) recommends you reading "post.title"
mλdcodez
oh.. what will be the correct format buddy? :)
mλdcodez
oh, okay buddy, thanks. :)
Code9
oh.. what will be the correct format buddy? :)
Looks like you're new to Python
mλdcodez
yep.
Code9
A few course on Codecademy would help
mλdcodez
i worked with java, cpp, c#, etc, but, new with py
mλdcodez
Someone
its pretty simple, add field is_draft boolean field with default True. when user submit set is_draft=False
I did same thing .. i thought there might be something else like best practise.. so asked .. Thanks 😊 bro
Django Bot
>> Links - How To Send And Receive Email With Django And Amazon SES - MicroPyramid
Django Bot
>> Links - DJANGO 2.0 - Django Login/Logout Tutorial
Anonymous
Cannot query "normaluser": Must be "SuperUser" instance. Hi, i wrote a register forms views and custom model but when i want to register a user i get this error, i have 3 class for my users because of i have 3 type of user SuperUser Developer NormalUser and i want to resgister as normaluser. i have no idea what should i tell more about it, if you can help tell me to send you my codes
Anonymous
did you get the error from your page or shell? how is your models looks like?
i get this error in page as a user. this is my model: https://beepaste.io/view/Gcbp9F
inchidi
i get this error in page as a user. this is my model: https://beepaste.io/view/Gcbp9F
you have so many User.objects.filter(user=user) there. is User custom user model?
Anonymous
you have so many User.objects.filter(user=user) there. is User custom user model?
yes, this is my custom user model code: https://beepaste.io/view/MY4ZS9
inchidi
you should replace with User.objects.filter(username=user.username) or something else depends on what you need
inchidi
i get this error in page as a user. this is my model: https://beepaste.io/view/Gcbp9F
also i think if you remove user_type = .... form field there it will be fine
Anonymous
you should replace with User.objects.filter(username=user.username) or something else depends on what you need
i don't understand why it's happend? because of i get to many field with user=user?
inchidi
i don't understand why it's happend? because of i get to many field with user=user?
am not trying by myself but from code you provided i can see thats the wrong part i guess
inchidi
*am still guessing tho
Anonymous
also i think if you remove user_type = .... form field there it will be fine
i need to limit choices because i create superuser along side other in User model
Anonymous
😅 thank you very much i need to try it
inchidi
then do that in template (not showing user_type depends on current user_type) then check again on your Form part
inchidi
or, dont use ModelForm i think