Skip to content

Tag: python

Django – login required for POST but not GET?

So I’m trying to do a site with user editable tags on items. I want users to be able to edit tags on the page only if they are logged in, but everyone should be able to view the page. The edits are done through a modelform. I can’t use the login_required decorator on the whole view because then on…

PyCharm noinspection for whole file?

Is it possible to disable an inspection for the whole file in PyCharm? The reason this is needed is when dealing with py.test. It uses fixtures which appear to shadow function parameters, and at the same time cause unresolved references. e.g.: There is also other warnings from py.test, such as using pytest.ra…

Best way of linking to a page in Django

I managed to create a URL tag for my index. But right now I’m confused how to add links to other pages. I put this on my urls.py The next thing I put this tag into the href: But what if I wanted to create a new page and would be linking to it. How would I do it the

How to unpack a Series of tuples in Pandas?

Sometimes I end up with a series of tuples/lists when using Pandas. This is common when, for example, doing a group-by and passing a function that has multiple return values: What is the correct way to “unpack” this structure so that I get a DataFrame with two columns? A related question is how I …

python random mouse movements

I would like to make random mouse movements in specified rectangle area (limited with coordinates x1, y1, x2, y2, x3, y3, x4, y4). Movements should be smooth, random, not just straight lines, go randomly up/down/left/right/etc for specified time duration. Could you give me a hand or working example I can lear…