Data dodania Pytanie
2017-01-12 11:01 Django : ManyToMany relation error ( object has no attribute) »
I am trying to define some ManyToMany relations in Django, but I have an error when I try to create related objects. My models.py : class PerfumeBra...
(2) odpowiedzi
2017-01-12 05:01 CSRF token fails on form submission when CSRF_COOKIE_DOMAIN is set »
I am setting CSRF_COOKIE_DOMAIN='.localhost'. After setting this form submission fails with csrf token error. Here are the details: https://gist.gith...
(0) odpowiedzi
2017-01-12 03:01 PyGame Sprites Occasionally Not Drawing »
I am trying to make a basic card game using PyGame. I am currently just trying to draw a single card to the screen. The weird thing is, occasionally i...
(1) odpowiedzi
2017-01-11 20:01 What is the new version of csrf in Django 1.10 »
I'm following a tutorial and getting a TypeError with this line: c.update(csrf(request)) This is the full view from django.shortcuts import render...
(1) odpowiedzi
2017-01-11 18:01 Why doesn't this if statement execute? »
I am trying to make a word guessing game. Everything works except for the last if statement part. If the user guesses the name correctly, it doesn't p...
(1) odpowiedzi
2017-01-11 16:01 Why is Collections.counter so slow? »
I'm trying to solve a Rosalind basic problem of counting nucleotides in a given sequence, and returning the results in a list. (For those ones not fam...
(2) odpowiedzi
2017-01-11 16:01 DataTables (serverSide) OK on first request, fails with "[Object object"] in request when searching or reordering »
Using DataTables jQuery plugin with serverSide = true (example here is small, but ultimately we want to handle large number of records). On initial re...
(1) odpowiedzi
2017-01-11 12:01 Concatenation of every row combination of two numpy arrays »
Given two arrays (A and B) of different shapes, I've like to produce an array containing the concatenation of every row from A with every row from B. ...
(2) odpowiedzi
2017-01-11 11:01 pip install Django on python3.6 »
If I run pip install Django I get Requirement already satisfied: Django in /usr/local/lib/python2.7/dist-packages I'd like to use python3.6 in...
(5) odpowiedzi
2017-01-11 10:01 XOR on contiguous subarrays of an array »
From an array, I need to find the value obtained by XOR-ing the contiguous subarrays, following by XOR-ing the values thus obtained. INPUT One line ...
(1) odpowiedzi
2017-01-11 08:01 CSRF Failed: CSRF token missing or incorrect after upgrading to django 1.10 from 1.8 »
I am sending a post request via AJAX to api (both the current page and api are under the same host). I am getting csrf failed: csrf token missing or i...
(1) odpowiedzi
2017-01-11 08:01 add link to Actions in Django Admin »
In Django admin I have a print button that sends information to the template. I want to add to the Action dropdown link where I checkboxes select the...
(1) odpowiedzi
2017-01-11 07:01 How do large scale databases handle locks? »
I have a question about databases and updating rows. I am currently running a flask application, and the endpoint runs a command like this (Please ac...
(3) odpowiedzi
2017-01-10 23:01 Merged two dataframe columns with lists in order of lists »
I'm trying to merge/concatenate two columns where both have related, but separate text data delimited by "|" in addition to replacing certain names wi...
(3) odpowiedzi
2017-01-10 23:01 Multiple matrix multiplication »
In numpy, I have an array of N 3x3 matrices. This would be an example of how I'm storing them (I'm abstracting away the contents): N = 10 matrices = ...
(1) odpowiedzi
2017-01-10 20:01 ruamel.yaml formatting of TimeStamp after deepcopy seems broken »
import copy import ruamel.yaml d = ruamel.yaml.round_trip_load("foo: 2016-10-12T12:34:56\n", preserve_quotes=True) d2 = copy.deepcopy(d) assert ruame...
(1) odpowiedzi
2017-01-10 19:01 Scala: system commands to a python script with arguments »
So I am sending this system command in Scala: val command = "python other/evaluateAnswers.py 'chemistry earth' 'the chemistry of the world in champa...
(1) odpowiedzi
2017-01-10 16:01 How to swap a group of column headings with their values in Pandas »
I have the following data frame: a1 | a2 | a3 | a4 --------------------- Bob | Cat | Dov | Edd Cat | Dov | Bob | Edd Edd | Cat | Dov | Bob an...
(3) odpowiedzi
2017-01-10 14:01 Can I access facebook friendlist of a user using graph API, or I need to scrape? »
I need to build a scraper that takes as input​ the Facebook credentials of a user and than scrapes all the friends of the user to do some statistica...
(1) odpowiedzi
2017-01-10 12:01 How can I exclude a view from the API documentation? »
I use django-rest-framework (DRF) to provide the REST API of a site of mine. From what I understand, the automatic generation of API documentation rel...
(1) odpowiedzi
2017-01-10 11:01 How to access all dictionaries within a dictionary where a specific key has a particular value »
I have a dictionary of dictionaries, with each nested dictionary having the exact same keys, like this: all_dicts = {'a':{'name': 'A', 'city': 'foo'}...
(4) odpowiedzi
2017-01-10 08:01 How to store data from html form to postgres database using Django 1.10? »
I am new to Django , i just created a simple form to store the user input to database, but the data is not stored while clicking submit button, when i...
(2) odpowiedzi
2017-01-10 06:01 Nested generator expressions behave unexpectedly »
With the following code: A = [1, 2] B = [-2, -1] C = [-1, 2] D = [0, 2] ab = (a + b for a in A for b in B) cd = (c + d for c in C for d in D) abcd =...
(3) odpowiedzi
2017-01-10 05:01 python high order function: generic functions calls with parameter list »
I am looking for a high order function in python that takes in a function as parameter and a list of corresponding parameters, and call the function o...
(2) odpowiedzi
2017-01-09 19:01 Django login "?next=" only saving one GET parameter »
I'm using Django 1.10 and Python Social Auth 0.1.0. I use Django login view, having only added the template with: <a href="{% url 'social:begin' ...
(2) odpowiedzi
2017-01-09 18:01 Is there a clean test for a dictionary element in Python? »
If I have an element I'm trying to get from a dictionary: my_dict[i]['level_1']['level_2']['my_var']. Is there a cleaner way than doing this to check...
(2) odpowiedzi
2017-01-09 18:01 Are there number limitations in python? »
I have made a Python 3 program to calculate pi for a school project, but it always stops at 16 decimal places. Is there a limit to the length of numbe...
(1) odpowiedzi
2017-01-09 11:01 Python: Censoring a word in text but last word does not censor »
I am doing Python on Codecademy trying to censor out a word in a text. The code works but if the last word in the text has the word, it will not be ce...
(5) odpowiedzi
2017-01-09 11:01 Repeat fields in django forms »
I would like to have a form containing three times two related fields (A name, and some ip address as a simple regex field) name1 name1 IPs ...
(2) odpowiedzi
2017-01-09 09:01 Randomly calling functions to execute »
I have made this short questionnaire: from random import randint def pancakes(): q = raw_input("Do you like pancakes?") if q == "yes": ...
(3) odpowiedzi
2017-01-09 08:01 Run interactive Bash with popen and a dedicated TTY Python »
I need to run an interactive Bash instance in a separated process in Python with it's own dedicated TTY (I can't use pexpect). I used this code snippe...
(2) odpowiedzi
2017-01-09 07:01 Django How to stop the execution of a function »
I am trying to call a python function by Ajax. I want to stop the execution of that function. I have tried to refresh the page but it doesn't stop. Wh...
(1) odpowiedzi
2017-01-09 02:01 GraphAPI error in Facebook python SDK: An active access token must be used to query information about the current user »
I'm using the Facebook SDK for python to programmatically post photos to a fan page I manage. Everything works perfectly locally, but fails in product...
(0) odpowiedzi
2017-01-08 23:01 Is LIBGDX Slower in python than Java »
I've been developing games in Python & Pygame for a while now, Though one thing that's been in mind is my dislike to pygame's performance and lack...
(1) odpowiedzi
2017-01-08 16:01 Find string within JSON with Python »
I'm currently getting a very long JSON and I'm trying to pick out 2 pieces of information from it through Python 2.7. The JSON looks roughly like thi...
(3) odpowiedzi