If I create a new entry for one particular model it doesn't show up in the django admin.
The Agency Model is causing the trouble.
# catalog.models
class Content(models.Model):
class Meta:
abstract = True
BUNDESLAND_CHOICES = (
('bw', 'Baden-Württemberg'),
('by', 'Bayern'),
('be', 'Berlin'),
...
What's the easiest way to write a daytime client in Python?
And if there's more data of unknown size but still plain text - how do I read until the server closes the connection?
...
I'm trying to send a raw ethernet frame with the length of my data written in the type field. This should be a valid ethernet frame. My code for this looks like this:
ethData = "foobar"
proto =len(ethData)
if proto < 46:
proto = 46
soc = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, proto)
soc.bind((iface, proto))
For some rea...
I'm starting to learn about Tkinter. I'd like to have a container widget ( Frame ), where the user could add as many textfields as needed by the application. The application starts with a textfield, and a button below that textfield. When the user presses the button, a new text entry will be added below the first one ( this may be repeat...
I'm looking for a simple way of range checking floats in Python where the minimum and maximum bounds may be null.
The code in question is:
tval = float(-b - discriminant) / float (2*a)
if tval >= tmin and tval <= tmax:
return tval
tval = float(-b + discriminant) / float (2*a)
if tval >= tmin and tval <= tmax...
I would like to find a regular expression (regex) that does detect if you have some invalid escapes in a C double quoted escaped string (where you can find double quotes only escaped).
I consider valid \\ \n \r \" (the test string is using ")
A partial solution to this is to use (?<!\\)\\[^\"\\nr] but this one fails to detect bad escap...
Hi i have string
s='This is sample'
i need to convert like this
s='"This is sample"'
output="This is sample"
how to do this in dynamic
Thanks in advance
...
Hi,
I have a filter that I use for lang support in my webapp. But when I publish it to gae it keeps telling me that it the usage of CPU is to high.
I think I located the problem to my filters I use for support. I use this in my templates:
<h1>{{ "collection.header"|translate:lang }}</h1>
The filter code looks like this:
import re
...
Hello guys,
Does anyone know a good IronPython book?
...
I am writing a cgi page in Python. Let's say a client sends request to my cgi page. My cgi page does the calculation and as soon as it has the first output, it sends back that output to the client, but it will CONTINUE to do the calculation and send other responses AFTER the first response is sent.
Is what I have presented here possibl...
I am making a z39.50 search in python, but have a problem with decoding search results.
The first search result for "harry potter" is apparantly a hebrew version of the book.
How can I make this into unicode?
This is the minimal code I use to get a post:
#!/usr/bin/env python
# encoding: utf-8
from PyZ3950 import zoom
from PyZ3950 i...
Hi,
Can any one point me to code where users can change their own passwords in Django?
Thanks.
...
Hi there,
With django admin, we have an history of who altered an object and when. I would like to add an "old value", "new value" to this to be able to roll back if needed.
Plus I would like every modification made to my objects (also outside of admin) to be recorded as well.
The final objective is to be able to trace every modificat...
The main objective of the following module, is to provide a kind of "constant" semantics for some names.
class ConstantError(Exception):
def __init__(self, msg):
self._msg = msg
class Constant(object):
def __init__(self, name):
self._name = name
def __get__(self, instance, owner):
ret...
Hello
By using the Psycopg2 of Python library, how can I determine if a table exists, getting a true or false boolean.
...
This subject has been disturbing me for some time.
For my Python project I wanted to be able to support Python versions 2.4 to 3.1. I thought a bit about how to do this, and eventually decided to have four separate forks of the source code for four different versions of Python: 2.4, 2.5, 2.6 and 3.1.
I have come to view that as a bad d...
Is there a better way of doing this? I don't really need the list to be sorted, just scanning through to get the item with the greatest specified attribute. I care most about readability but sorting a whole list to get one item seems a bit wasteful.
>>> import operator
>>>
>>> a_list = [('Tom', 23), ('Dick', 45), ('Harry', 33)]
>>> sor...
I would like to make server that listen on UDP port 162 (SNMP trap) and then forwards this traffic to multiple clients. Also important is that the source port & address stays same (address spoofing).
I guess that best tool for this would be Twisted or Scapy or maybe vanilla sockets,
only I can't find anything in the documentation for T...
Has anyone setup a apache2 and mod_python with stackless on ubuntu? If yes can you please post here the steps involved?
Thanks in advance
...
Due to the sheer annoyance of figuring out what to Google, I've decided to risk what any reputation I had to ask this rather simple question.
As PEP8 suggests keeping below the 80 column rule for your python program, how can I abide to that with long strings, i.e.
s = "this is my really, really, really, really, really, really, really l...