Include a menu to several templates in Django

I'm trying NOT to write same code twice on different templates. Real hassle when changing something. So when I go to a section of the webpage, I want to display a side menu. This side-menu is suppose to be on several templates. Like index.html, deta...
more »

2017-09-18 22:09 (1) Answers

Django best practice for extending User model

I want to extend the build-in User model in Django. I do this by just creating a subclass inherited from User. The main problem is that when I retrieve user = request.user, this user is the built-in User type instead of the new subclass I create. S...
more »

2017-09-18 17:09 (1) Answers

Installing requirements.txt

I am new to the Wagtail cms and am taking over a friend's project for his site. I have downloaded his repo and am trying to get it to run locally. I have followed the steps on the wagtail documentation
more »

2017-09-18 15:09 (2) Answers

Copy static files to volume on deployment?

How can I ensure that the most recent static files created during deployment of a Django application are copied to a volume? My web container defines a Django application that, when built, runs python collectstatic --noinput --clear. This...
more »

2017-09-18 13:09 (2) Answers

best practice for documenting django templates?

I am documenting my Django project with SPHINX, following this tutorial Sphinx extracts Python docstrings from my python files to build a user readable documentation. But I wish to also document my django templates ( .html ) What are best practices...
more »

2017-09-18 12:09 (1) Answers

django - error adding database to heroku

I am struggling to deploy my app on heroku. Mainly due to database configuration. This is the bottom of the file, import dj_database_url DATABASES = { 'default': dj_database_url.config() } try: from .local_settings import * excep...
more »

2017-09-18 08:09 (2) Answers

Structuring Django Project

I know that you're supposed to have a templates folder within each app folder, how I have two questions clarify further. 1, Should I have 2 base.html files (one in each app) that are identical? This seems like it's creating more files than need be......
more »

2017-09-17 22:09 (1) Answers

why is the user authentication unsuccessful?

i am trying to build login page using django authentication system below is the views from django.contrib import auth def auth_view(request): username = request.POST.get('username','') password = request.POST.get('password','') print re...
more »

2017-09-17 22:09 (1) Answers

if and elif doesn't work in template django

if and elif doesn't work in my template django index.html <a style="{% if show.Ages == 19 %}background:#ff3636;{% elif show.Ages == 17 %}background:#fb9c92;{% elif show.Ages == 13 %}background:#ffb466;{% else %}background:#4aff68;{% endif %};bor...
more »

2017-09-17 14:09 (1) Answers

Cannot include urls from my app in django

I am following the TDD web development with Python to learn Django. It is based on Django 1.8 but I am trying to follow it on Django 1.11. There seem to be too many changes since 1.8. My app(lists) was working perfectly before I was tolod by the auth...
more »

2017-09-16 22:09 (2) Answers

Django Images for individual users not showing

I have page with a list of all the users in my system. Each user in the lists displayed with three things: 1. their profile picture, 2. their first name, and 3. their user type. However, while the profile picture does show, it does not show the corre...
more »

2017-09-16 22:09 (1) Answers

VueJS props are undefined in component

I am trying to integrate VueJS with my frontend for my Django applications. I have the following Vue code in a javascript file: window.onload = function() { Vue.component('discuss-post', { props: ['post'], template: `<div cla...
more »

2017-09-16 04:09 (3) Answers

adding instances from django admin

This is how my classes look. class School(models.Model): state = models.ForeignKey(State, on_delete=models.CASCADE) region = models.ForeignKey(Region, on_delete=models.CASCADE) cluster = models.ForeignKey(Cluster, on_delete=models.CASCAD...
more »

2017-09-15 18:09 (1) Answers

Iterating through json list in Django template

I am passing the following context in my Django template : context = {'test': custom_json_list} And the output of custom_json_list is this : {'pc_16530587071502': [{'people_count_entry__sum': None}], 'pc_17100675958928': [{'people_count_entry_...
more »

2017-09-15 15:09 (1) Answers

How to query the bilaminar data in Django ORM?

I have two models: class AddressRegion(models.Model): name = models.CharField(max_length=8) class AvailableArea(models.Model): name = models.CharField(max_length=8) addressregion = models.ForeignKey(AddressRegion, default=1) In the ...
more »

2017-09-15 10:09 (1) Answers

Django template Module Import Error

Using Django version 1.9.5 and Python 3. Upon navigation to the url, I am getting the following error: ImportError at /music/ No module named 'django.templates' Request Method: GET Request URL: http://localhost:8000/music/ Django Version: 1.9.5...
more »

2017-09-15 01:09 (2) Answers

HttpResponseRedirect not working as expected

In my I have: return HttpResponseRedirect('/account/forecast/') The problem I'm running into is that the response url is being appended. e.g. from: the redirect goes to: ...
more »

2017-09-14 21:09 (0) Answers

msi creation needs using cx_freeze in python

Suppose, I have written a code in python 2.7 . let's say i am using vlc player in my script and now i have created a msi file for my code so how to install "vlc player" in user's system during installation of msi file of my python code. Please give ...
more »

2017-09-14 13:09 (1) Answers

Dynamic models django

Let's say i have 10 tables in 1 Db and the table names differ and data is different, but the structure of the tables are the same. And then i have 1 more table that collects all the table names and the creation date of that table. Example: PrimaryT...
more »

2017-09-14 09:09 (2) Answers

Django on mod_wsgi syntaxError

I installed Django 1.11.5 with Virtualenv on mod_wsgi. python version is 2.7.13. I get this error in /var/log/httpd/error_log: [Wed Sep 13 16:41:00 2017] [error] [client] mod_wsgi (pid=9606): Target WSGI script '/var/www/html/memit/mem...
more »

2017-09-13 22:09 (0) Answers