These are chat archives for django/django

22nd
Sep 2017
juxley
@juxley
Sep 22 2017 00:55
Hello! Any one have a good start resources for Django? I don't mind paying for good quality
MilanRgm
@MilanRgm
Sep 22 2017 03:01
I recommend you check this and start learning from here https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django
after you complete learning from the link i referred, you can check https://simpleisbetterthancomplex.com/
hypersoniq
@hypersoniq
Sep 22 2017 06:37
This site is filled with Python tutorials. Here is the Django section... https://pythonprogramming.net/django-web-development-with-python-intro/
Luke-VideoLibre
@LukeVideo
Sep 22 2017 07:46
@juxley You want to go through the documentation tutorial for starters. There is a course by coding entrepreneurs here https://youtu.be/yDv5FIAeyoY free on YouTube but you can get it on udemy to. Paying for it gives you access to a nicely chaptered version of the course and probably some source code.
Luke-VideoLibre
@LukeVideo
Sep 22 2017 09:18
And i've just solved my problem with the filtering of messages...
user_messages = CluedoMessage.objects.all().filter(receiver__user = user)
I didn't know about this double underscore descritption off the field your looking for. Excellent work Django team !
Kaushal Kumar
@kaushal087
Sep 22 2017 09:26
Post request is coming to my view. This request has image and other data. I have to call two different utility function which in turns call some API. I can't modify the utility function because many other functionality is dependent on them.
One utility function expect request of type Content-Type: application/json only without image
The other expect request having image. So basically I have to create two request of different type from one single request and pass to two different utility function. How do I approach this?
Joseph Safwat Khella
@JosephSKh
Sep 22 2017 13:26
hello from Egypt guys !!
does anyone know how to upload using angular2 service with complete restful api?
thx
Luke-VideoLibre
@LukeVideo
Sep 22 2017 14:40
there one thing i don't get. That's how do i get to use any attributes of my UserInfo model now ????
This is in my views.py
def sendMessage(request):
    user = request.user
    print(user)
    message_form = messageForm()
    message_raw_form = messageRawForm()
    userInfo = UserInfo.objects.all().filter(user = user)
    print('userinfo ->')
    print(userInfo)
    cypherUser_messages = CluedoMessage.objects.all().filter(receiver__user = user)
so if i try to get userInfo.something i get a 'QuerySet' object has no attribute 'something' ...
Maybe i get it wrong but should i use these attributes in the template???? I have to decode some text and i thought i really should do that in the view.py.
Rod
@sixtycycles
Sep 22 2017 15:01
@accimeesterlin Thank you! (sorry its been a while) found them in the settings file!
Luke-VideoLibre
@LukeVideo
Sep 22 2017 15:55
@LukeVideo It's probably time to pull DRF...
Luke-VideoLibre
@LukeVideo
Sep 22 2017 16:21

So... If i am in a request.method = POST form i can .save(commit=false) and mess around with the data. But if i try to do it on the default request method it fails....

if request.method == "POST":

        message_form = messageForm(data=request.POST)
        message_raw_form = messageRawForm(data=request.POST)

        if message_form.is_valid() and message_raw_form.is_valid():
            message = message_form.save(commit=False)
            messageRaw = message_raw_form.save(commit=False)
def sendMessage(request):
    user = request.user
    print(user)
    message_form = messageForm()
    message_raw_form = messageRawForm()
    userInfo = UserInfo.objects.filter(user = user)

trying to save(commit=false) userInfo fails... I wonder how i can edit this data before handling it in the template. I don't think finding an equivalent library to parse the data in JS is the cleverest way to go...

juxley
@juxley
Sep 22 2017 18:36
@LukeVideo @MilanRgm Thank you! Will working in Java and JavaScript have any carry over besides general programming practices?
And thank you! @hypersoniq
Luke-VideoLibre
@LukeVideo
Sep 22 2017 18:38
@juxley not sure if you want js or python or just base's?
There is a free js basics on udemy !
juxley
@juxley
Sep 22 2017 18:39
No no, I know some JS. I'm just wondering if knowing JS will help me out with working with Django
Luke-VideoLibre
@LukeVideo
Sep 22 2017 18:40
Well kinda yeah. To get the basics line if statements for loops.
You got to play around with simple projects first to understand URLs models views templates... I'm still learning...keep it simple and try different things
juxley
@juxley
Sep 22 2017 18:43
Gotcha. Yeah I'm having fun still with HTML/CSS and JavaScript there's so much you can do. I wanted to learn Python and someone told me about Django so I thought it would be a cool transition... So you'll see me appearing on this chat!