These are chat archives for django/django

5th
Feb 2017
Priyanka Gaur
@priyanka303
Feb 05 2017 05:53
hey i want a help regarding python-yaml i am not able to access yaml nodes to my python file can any body help me in this
hey i want a help regarding python-yaml
i am not able to access yaml nodes to my python file
can any body help me in this
Alexandro Pequeno
@Argestis
Feb 05 2017 05:58
Hello guys!
Priyanka Gaur
@priyanka303
Feb 05 2017 12:05
any body here for the above question ??
Gourav Chawla
@Gouravchawla
Feb 05 2017 12:26
Do you have some code to show?
cs89gr
@cs89gr
Feb 05 2017 12:27
@Gouravchawla Mr.can you help me ?i show my code before thnx you
Apophus
@Apophus
Feb 05 2017 12:29
HEy guys..
I'm trying to create a new virtual environment to run python3.... I need a little help.. Anyone?
Gourav Chawla
@Gouravchawla
Feb 05 2017 12:32
@cs89gr What is the error that you are getting when submitting?
@Apophus Sure.
Ask any questions that you have after that.
Apophus
@Apophus
Feb 05 2017 12:37
Thanks alot @Gouravchawla , I'll get back to you in a min
Awesome @Gouravchawla . I'll make sure to share your blog.. It worked
Apophus
@Apophus
Feb 05 2017 12:42
one more question..
What if I wanted a more specific version of python? eg.. python 3.5 or 3.6?
cs89gr
@cs89gr
Feb 05 2017 12:42
@Gouravchawla error connection in the browser
@Gouravchawla i thing so my html form is wrong
Gourav Chawla
@Gouravchawla
Feb 05 2017 12:52
@Apophus Thanks you liked it. And it is general to python3. So, whichever python version is installed in your system, it would use that.
@cs89gr The traceback error you get has a lot of information. Post the whole error page using pastebin like service here. It'll give me a better understanding of the error.
cs89gr
@cs89gr
Feb 05 2017 12:55
blob
@Gouravchawla and message and that message when i stop server UserWarning: A {% csrf_token %} was used in a template, but the context did not provide the value. This is usually caused by not using RequestContext.
"A {% csrf_token %} was used in a template, but the context "
[05/Feb/2017 14:49:04] "GET / HTTP/1.1" 200 309
Priyanka Gaur
@priyanka303
Feb 05 2017 12:59
hey i want a help regarding python-yaml
i am not able to access yaml nodes to my python file
can any body help me in this
Gourav Chawla
@Gouravchawla
Feb 05 2017 13:10
@priyanka303 What is exact problem? What is the code you are using?
Apophus
@Apophus
Feb 05 2017 13:11
@Gouravchawla Thanks.. It still works
Gourav Chawla
@Gouravchawla
Feb 05 2017 13:13
@cs89gr First of all, I can see you are trying to publish num.url etc on the page without checking if it's already there. That in itself can cause problems.
cs89gr
@cs89gr
Feb 05 2017 13:14
@Gouravchawla but how to fix html form ?i thing so the problem is in the action ?the num publish is test
@Gouravchawla i have the some error and without code for num :worried:
It might help
cs89gr
@cs89gr
Feb 05 2017 13:29
@Gouravchawla the problem is the render or html form ?i thing so the second because if the html form work fine then i put submit then the html do nothing without error,right ?
Gourav Chawla
@Gouravchawla
Feb 05 2017 13:38
@cs89gr It could be both but what I think is first you should replace render_to_response with the render method.
Then see, what happens.
cs89gr
@cs89gr
Feb 05 2017 13:41
@Gouravchawla mm ok i will try but tell me the method when i use to take images from html form and try to processing without save that image in the some model and return the new images back to html is right ?but i have bad coding ?
Nadir
@nadirollo
Feb 05 2017 18:06
Hello.
First, I’m not a django expert, so bare with me through the question. I might be trying something that can not be done, or should not be done, or …
I’m trying to define my models, and create a form view based on the models for a structure that looks something like this:
untitled.jpg
Is it possible to have formsets that include formsets (every arrow in that graph is a ForeignKey) and I would like to present a formulary to be able to modify the whole structure at the same time
I can’t seem to find a way to have more than one level of formsets. I can create a formset for the first level, but after that, it becomes unclear to me how to achieve it.. :(
Nadir
@nadirollo
Feb 05 2017 18:32
Any clue would be amazing :)
cs89gr
@cs89gr
Feb 05 2017 19:08

how to fix error ?

UserWarning: A {% csrf_token %} was used in a template, but the context did not provide the value.  This is usually caused by not using RequestContext.
  "A {% csrf_token %} was used in a template, but the context "

show that message every time where i stop my server

John
@flyboy1565
Feb 05 2017 19:24
@cs89gr can you post your code where you're rerurning the template
cs89gr
@cs89gr
Feb 05 2017 19:38
@flyboy1565 ok i can
Bartlomiej Wiater
@wiaterb
Feb 05 2017 19:41
@nadirollo have you tried formsets iheritance?
cs89gr
@cs89gr
Feb 05 2017 19:45

def calc(request):
    form = ImageUploadForm()
    if request.method == "POST" and form.is_valid():
        image_file = request.FILES['image']
        form.save()


    return render_to_response ('blog/calc.html', {'form':form}, RequestContext(request))
 <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form method="POST" enctype="multipart/form-data">{% csrf_token %}
    {{ form.as_p }}
    <input type="button" value="Submit">
</form>
from django import forms

class ImageUploadForm(forms.Form):
    """Image upload form."""
    image = forms.ImageField()
Nadir
@nadirollo
Feb 05 2017 19:46
@wiaterb haven’t yet, but I’m just taking a look, thanks!
Bartlomiej Wiater
@wiaterb
Feb 05 2017 19:53
@nadirollo good luck