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

Python 3: RuntimeWarning with numpy.power

When using numpy.power(2,N), where N is an integer, I encounter the following issue: In[1] np.power(2,63) Out[1] -9223372036854775808 RuntimeWarning: invalid value encountered in power and even more strangely, In[2] np.power(2,63)*2 Out[2] 0 Th...
more »

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

Take every nth block from list

Given a list: import string a = list(string.ascii_lowercase) What is the Pythonic way to return every nth block of m elements? Note that this is different from just returning every nth element. Desired result of taking every 1st block of 3 eleme...
more »

2017-09-18 17:09 (6) 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 http://docs.wagtail.io/en/v1.12.1/getting_star...
more »

2017-09-18 15:09 (2) 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 settings.py 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

Extracting and transforming data in numpy

Suppose I have the following numpy vector [[1, 3., 'John Doe', 'male', 'doc', '25'], ..., [9, 6., 'Jane Doe', 'female', 'p', '28']] I need to extract relevant to my task data. Being a novice in numpy and python in general, I would do it in t...
more »

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

Embedded python issue

I am new to Python and embedded python altogether. When trying to run some basic python commands from C++, It seems that some of my imports do not work from C++ but they do work when I run them from python shell. This is the basic instructions that...
more »

2017-09-17 15:09 (0) 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