I have a flash map of the UK which is divided up into the counties, a user clicks on a county and is then directed to a new url, eg. www.mydomain.co.uk/region/london. The flash map remains on that new page in case they wish to select a new region.
What I want to know: is it possible to manipulate the flash so that if the url is www.mydo...
I'm working on a not-so-big project in django that will among other things incorporate a forum system.
I have most of the system at a more or less functioning state, but I'm still missing a feature to mark unread threads for the users when there are new posts.
The thing is I can't really think of a way to properly store that informatio...
I have a 7-tuple of tuples as such:
POSSIBILITIES = ((1, "Something"),
(2, "Something else"), ...)
Now I have an IntegerField with choices in a model with the possibilities listed above.
class Something(models.Model):
class Meta:
ordering = "...?"
something = models.IntegerField(choices=POSSIBILITIE...
I am trying to setup django with fastcgi on apache. Django is installed and seems to be running correctly but I am having problems with setting up fastcgi.
I decided to test out my dispatch.fcgi script in the interactive python shell line by line and the following line:
from django.core.servers.fastcgi import runfastcgi
results in th...
Is there a recommended way of using Django to clean an input string without going through the Django form system?
That is, I'm writing code that delivers form input via AJAX so I'm skipping the whole Form model django offers. But I do want to clean the input prior to submission to the database.
...
The particular case I have is like this:
I have a Transaction model, with fields: from, to (both are ForeignKeys to auth.User model) and amount. In my form, I'd like to present the user 2 fields to fill in: amount and from (to will be automaticly set to current user in a view function).
Default widget to present a ForeignKey is a selec...
Hi,
with Django forms you can specify widget:
class LoginForm(forms.Form):
email = forms.CharField(
max_length = 30,
widget = forms.TextInput(
attrs = {'class':'text required email', 'id':'email'}))
password = forms.CharField(
max_length = 20,
widget = forms.PasswordInput(
attrs = {'class':'text ...
I have Django Model with many fields which user must fill. If I'll create one ModelForm for this Model it will be big enough for one form. I want to split it using FormWizard. I think it's possible first to create forms dynamically and then create FormWizard using them.
Is this good approach or is there any better way?
...
The Django admin site makes use of a really cool widget:
How can I make use of this widget in my own applications? I don't see anything like that listed here.
...
The Django orbit integration methods I've seen in quick google searches don't seem to carry Django abstractions, like "request.user" with them. "request.user" is particularly important, since I am not going to (potentially incorrectly) re-implement session handling (this sounds like it could cause bad security bugs).
Alternatively, shou...
Hello,
I have the following code in the view call..
def view(request):
body = u""
for filename, f in request.FILES.items():
body = body + 'Filename: ' + filename + '\n' + f.read() + '\n'
On some cases I get "UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 7470: ordinal not in range(128)". What a...
I want to let a few users to be able to access the django admin site, but in some models allow permission to only being able to view the list of objects.
Is there an easy way of doing this or should I just create a view to show this information?
...
I'm having a bit of difficulty understanding how the python __init__( ) function works. What I'm trying to do is create a new form in django, and use the uni_form helper to display the form in a custom manner using fieldsets, however I'm passing an argument to the form that should slightly change the layout of the form and I can't figure...
Hello all,
First I'll lay out what I'm trying to achieve in case there's a different way to go about it!
I want to be able to edit both sides of an M2M relationship (preferably on the admin page although if needs be it could be on a normal page) using any of the multi select interfaces.
The problem obviously comes with the reverse sid...
How do I inherit a ModelManager?
class Content(models.Model):
name = models.CharField(max_length=255, verbose_name='Name des Blogs')
slug = models.SlugField(max_length=80, blank=True)
objects = models.Manager()
active = ContentActiveManager()
class ContentActiveManager(models.Manager):
def get_query_set(self):
...
I have some custom logic that needs to be executed every single time a URL is reversed, even for third-party apps. My project is a multitenant web app, and the tenant is identified based on the URL. There isn't a single valid URL that doesn't include a tenant identifier.
I already have a wrapper function around reverse, but now I need a...
Hi,
I am getting an array arr passed to my django template . I want to access individual elements of the array in the array e.g. arr[0],arr[1] etc instead of looping through the whole array.
Is there a way to do that in a Django template ?
Thank You
...
Hi,
I want to see if the number of elements in an array in my Django template is greater than 1. Can i use the following syntax for doing that ?
{% if {{myarr|length}} > 1 %}
<!-- printing some html here -->
{% endif %}
Thank You
...
I'm indexing a model with xapian/haystack. When i test it on my local machine everything works just fine, but when i try to save a model on the server Xapian throws a DatabaseLockError
Exception Type: DatabaseLockError
Exception Location: /opt/python2.6/lib/python2.6/site-packages/xapian.py in __init__, line 2886
2886: _xapian.Writable...
Hi, I just started Django and Python, so Im still new to this..
This is my urls.py:
url(r'(?P<slug>[-\w]+)/$','person_detail'),
url(r'(?P<slug>[-\w]+)/delete/$','person_delete'),
The problem is that when I try to do to the url: slug/delete/ it's looking for that whole part slug/delete/ as the slug. When i remove the $ in the 1st url i...