These are chat archives for django/django

8th
Jun 2016
Andrew Backer
@awbacker
Jun 08 2016 03:32
@megapctr Why use factoryboy over modelmommy? (http://model-mommy.readthedocs.io/en/latest/basic_usage.html)
Filip Figiel
@megapctr
Jun 08 2016 05:15
Only reason I recommend it
I didn't know anything else
Mommy looks cool, thanks
samkurma
@samkurma
Jun 08 2016 05:37
i customized django admin login part, but when admin login expired, it's again redirecting to django admin login page with click option, please suggest me, where can i look into it, to redirect to my customized login page
Filip Figiel
@megapctr
Jun 08 2016 05:51
Alexey Kalinin
@Alkalit
Jun 08 2016 06:39
Hi guys, is there is any live demo of django builtin admin interface? With all features that it have. On my new work we were using custom admin some long time, but now we trying to drop it and return to django admin. And my boss asking me for examples of it for future customization.
sumit sinha
@sumitsinha91
Jun 08 2016 06:40
how to Creating PDFs with django (wkhtmltopdf)
???
can anyone help me
Alexey Kalinin
@Alkalit
Jun 08 2016 06:48
@sumitsinha91
There is some docs about it
https://docs.djangoproject.com/en/1.9/howto/outputting-pdf/
mpachas
@mpachas
Jun 08 2016 06:48
@Alkalit There is a demo for django autocomplete light in admin that uses new 1.9 interface, check it http://dal-yourlabs.rhcloud.com/
Alexey Kalinin
@Alkalit
Jun 08 2016 06:51
@sumitsinha91 The main idea is that you should use some pdf library and generate document during user request in ur view.
Alexey Kalinin
@Alkalit
Jun 08 2016 06:58
@mpachas Thanks, it's looks nice, but I’m guessing that django admin have more features that this demo shows.
sumit sinha
@sumitsinha91
Jun 08 2016 07:02
hey i am able to print as pdf
using this link
but
my question is that i need to any change in my view.py file????
@Alkalit https://docs.djangoproject.com/en/1.9/howto/outputting-pdf/
i have all ready used this link and created pdf using reportlab
now i and know about wkhtmltopdf
how i will design using html code to print in pdf
sumit sinha
@sumitsinha91
Jun 08 2016 09:59
i have use this one
but i unable to do
i got print as text on my pdf
friendOfOurs
@friendOfOurs
Jun 08 2016 11:23
what would be the most propriate way to have a CBV only to render form (no submit i.e. processing of the form). Is TemplateView with form in context good choice? Or maybe FormView but to override post method?
Taras
@ihappycoder
Jun 08 2016 16:15
@friendOfOurs FormView is a good one, if you don’t want to allow any submitting for client, just add js event listener to the form for preventing submitting http://stackoverflow.com/questions/8664486/javascript-code-to-stop-form-submission
Erik Buter
@AerikAwesome
Jun 08 2016 16:21

Hey guys, total amateur here. Before I started using Django, my website used JS to load the contents of some hidden divs for the other tabs it featured after page load.

<div class="tab-content">
        <div role="tabpanel" class="tab-pane fade in active" id="home" class="container">
            <div>
                <h1>title</h1>
                <p class="lead">content</p>
            </div>
        </div>

        <div role="tabpanel" class="tab-pane fade" id="blog" class="container">
            <h1>If you see this, something went wrong.</h1>
        </div>

        <div role="tabpanel" class="tab-pane fade" id="projects" class="container">
            <h1>If you see this, something went wrong.</h1>
        </div>

        <div role="tabpanel" class="tab-pane fade" id="about" class="container">
            <h1>If you see this, something went wrong.</h1>
        </div>

        <div role="tabpanel" class="tab-pane fade" id="contact" class="container">
            <h1>If you see this, something went wrong.</h1>
        </div>

    </div>
    <script type="text/javascript">
        $(document).ready(function() {
            $('#blog').load('includes/blog.html');
            $('#projects').load('includes/projects.html');
            $('#about').load('includes/about.html');
            $('#contact').load('includes/contact.html');
        });
    </script>

Is there a way to achieve the same effect using Django?

Honoré HOUNWANOU
@mercuryseries
Jun 08 2016 17:20
You can simply use the power of the django templates
@AerikAwesome No reason to use JQuery if your includes/*.html just contain some static content
Search for "include"
Erik Buter
@AerikAwesome
Jun 08 2016 17:23
The reasoning behind it was that I want it to load the still invisible content after the visible part of the page, which is why I tried using $(document).ready
Honoré HOUNWANOU
@mercuryseries
Jun 08 2016 17:26
I see
You can still do it
by creating dedicated routes for your includes/* files
each view should render the appropriate html content
so you can fetch it easily
Take a look at this post
That might help
Erik Buter
@AerikAwesome
Jun 08 2016 17:55
Thanks, I'll have a look at that