Login
main >   django >  


To debug a view I do the following:

have a template:

debug.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style>
        table {
            border-collapse: collapse;
        }
        td {
            border: 1px solid black;
        }
        </style>
    </head>
    <style>
    </style>
    <body>
        <table>
            {% for key, value in dbg.items %}
            <tr>
                <td>{{ key }}</td><td>{{ value }}</td>
            </tr>
            {% endfor %}
        </table>
            <br><br>
    </body>
</html>

In the view:

def view_name(request):
...
    if request.method == 'POST':
        post_values = {}
        for key in request.POST:
            value = request.POST[key]
            post_values[key] = value
    dbg = locals()
    return render(request, 'debug.html', locals())

Seamless page updates

https://testdriven.io/courses/real-time-app-with-django-channels-and-angular/

Channels

https://www.youtube.com/codingentrepreneurs
joincfe.com/github

Specific objectives

Model:
https://www.youtube.com/watch?v=cS_Yw0Kcukg&index=7&list=PLEsfXFp6DpzQFqfCur9CJ4QnKQTVXUsRy&t=0s
https://docs.djangoproject.com/en/1.11/ref/models/fields/

Model Admin:
https://www.youtube.com/watch?v=Xb9zfoJJzWg&index=8&list=PLEsfXFp6DpzQFqfCur9CJ4QnKQTVXUsRy
https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#modeladmin-options

View:
https://www.youtube.com/watch?v=SyFHmPh0tfo&list=PLEsfXFp6DpzQFqfCur9CJ4QnKQTVXUsRy&index=10

URL:
https://www.youtube.com/watch?v=gqRLPx4ZeSw&index=12&list=PLEsfXFp6DpzQFqfCur9CJ4QnKQTVXUsRy
regex url:
https://github.com/codingforentrepreneurs/Guides/blob/master/all/common_url_regex.md

Forms:
https://docs.djangoproject.com/en/1.11/topics/forms/
https://simpleisbetterthancomplex.com/article/2017/08/19/how-to-render-django-form-manually.html

CRUD:
https://www.youtube.com/watch?v=nw3R2TXlkwY&index=13&list=PLEsfXFp6DpzQFqfCur9CJ4QnKQTVXUsRy

Queries:
https://www.youtube.com/watch?v=9JbrwQApKpY&index=16&list=PLEsfXFp6DpzQFqfCur9CJ4QnKQTVXUsRy

Dynamic URL routing:
https://www.youtube.com/watch?v=WNrHf49HVuY&list=PLEsfXFp6DpzQFqfCur9CJ4QnKQTVXUsRy&index=18

Template Inheritance:
https://www.youtube.com/watch?v=9x_V3rv9kR0&list=PLEsfXFp6DpzQFqfCur9CJ4QnKQTVXUsRy&index=24

Upload Images:
https://www.youtube.com/watch?v=Rr1-UTFCuH4&index=28&list=PLEsfXFp6DpzQFqfCur9CJ4QnKQTVXUsRy

Upload Multiple Files:
https://docs.djangoproject.com/en/2.1/topics/http/file-uploads/#uploading-multiple-files

Many-to-Many
https://docs.djangoproject.com/en/2.1/topics/db/examples/many_to_many/

Template using base pages:
https://stackoverflow.com/questions/31456576/django-footer-and-header-on-each-page-with-extends

hidden1

hidden2