I want to pass a parameter, when i click submit button.
urls.py
urlpatterns = patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
(r'^home/$', 'views.home'),
(r'^home/(?P<build>[^/]+)/$', 'views.run'),
(r'^run/delete/$', 'views.runDelete')
)
run.html
<form nam...
There is a model:
class DomainPosition(models.Model):
domain = models.ForeignKey(Domain)
keyword = models.ForeignKey(Keyword)
date = models.DateField()
position = models.IntegerField()
class Meta:
ordering = ['domain', 'keyword']
How to get the data for a template? For each domain want to display table (fi...
when i call runDelete, then it will call run, so why "view didn't return an HttpResponse object" happen?
thanks:)
views.py
def run(request, build):
run_list = []
target_dict = {}
target_num = 0
build_id = 0
all_run_list = TestRun.objects.all().order_by('id')
for run in all_run_list:
build_version = r...
Hi all,
I start using matplotlib a month ago, so I'm still learning.
I'm trying to do a heatmap with matshow. My code is the following:
data = numpy.array(a).reshape(4, 4)
cax = ax.matshow(data, interpolation='nearest', cmap=cm.get_cmap('PuBu'), norm=LogNorm())
cbar = fig.colorbar(cax)
ax.set_xticklabels(alpha)
ax.set_yticklabel...
and does it worth the efforts?
...
I am using the Django query filter __search to perform a full text search e.g
MyModel.objects.filter(title__search = 'some title')
How do I get it to order by relevance, as currently it seems to be ordering alphabetically?
Specifically I would like search results where the title was some title to appear first before something that ha...
I have attached TestInline in the FoobarAdmin, this thing works well but i want logged in user to be pre-populated for the added_by field
from django.contrib import admin
from django.contrib.auth.models import User
class Test(models.Model):
description = models.TextField()
added_on = models.DateTimeField(auto_now_add=True)
...
On my model I have
class Meta:
ordering = ['title']
Is there a way I can leave this in the model definition as its useful elsewhere but in a query tell it to ignore it without having order by?
...
I have the following (stripped down) code:
# games/models.py
side_choices = [('A', 'Attack'), ('D', 'Defense')]
position_choices = [(0, 'Commander'), (1, 'Knight'), (2, 'Mage'), (3, 'Healer')]
class Game(models.Model):
users = models.ManyToManyField(User, through='GameParticipation)) // User is Django's user
class GameParticipatio...
I am trying to implement the following setup:
I have 5 different Apps. All 5 are part of one project.
I am trying to extract all the common elements these different apps have.
Than I want to make those elements variables that I can than make the view.py paste into templates I create.
So I have templates that have variables in it like...
I have been working on forms only recently and I am still puzzeld by them.
What I want are standard Forms:
Next Button
Submit Data to Db
Timestamp
Clickable Images with Regions defined where when I click I get to the next page
And
I would like to combine these.
E.g. have a next button + Record the Timestamp.
or
E.g. Click into an...
When running nosetests, django-nose runner doesn't supply --with-django option to nosetests, so my nose + Twill tests fail when trying to access URLs:
./manage.py test
...
raise BrowserStateError("cannot go to '%s'" % (url,))
BrowserStateError: cannot go to 'http://127.0.0.1:8088/admin/'
-------------------------------------------------...
Hey,
I am developing a new project from scratch with Django. I see that there are many apps for handling translation of dynamic content.
Django-multilingual
Django-pluggable-model-i18n
Django-modeltranslation
Transdb
Django-multilingual-model-
Django-transmeta
to name few.
Transdb, transmeta and multilingual sounded fair, but I wa...
I my model users can create rifles and this rifle is obviously associated with a User.
class Gun(ImageModel):
user = models.ForeignKey(User)
...
...
...
I have another model which is dependent on this and need to make use of the users rifles, but when the user adds a record I only want to display his rifles.
mt ...
I'm using a modelform for User like so:
class UserForm(forms.ModelForm):
class Meta:
model = User
fields = ('username','password','email',)
but the password field shows up as a regular textfield, not a password input. How do I make sure it shows a password field?
I tried this:
class UserForm(forms.ModelForm):
...
I'm looking to provide super-user access to entities belonging to a specific country.
eg. Swedish SU can only admin Swedish entities, etc...
However, I'm new to django (taking over an old system) and I need a lifeline.
I'd like to be able to specify a relationship table.
I've already added a userprofile and with that I have a new fi...
I've been trying to add the django-lean app to my project.
The django-lean app is not located in the project I'm working on, it is on the PYTHONPATH.
I have not been able to get the django-lean tests to pass.
It seems the issue is that the TestCase defines a value for urls:
urls = 'django_lean.experiments.tests.urls'
As best as I...
I previously had models like this:
class AssemblyAnnotation(models.Model):
assembly = models.ForeignKey(Assembly)
type = models.ForeignKey(AssemblyAnnotationType)
...
def clean(self):
from django.core.exceptions import ValidationError
if not self.type.can_annotate_aliases and self.assembly.alias_of_id is ...
I find this documentation extremely confusing:
http://south.aeracode.org/docs/customfields.html
If someone could walk me through this or at least give a full example, I would be very grateful.
...
I'm getting a KeyError for 'password' when I try to submit my form.
trace:
Request Method: POST
Request URL: http://localhost:8000/register/
Django Version: 1.2.1
Python Version: 2.7.0
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'djangoproject1.authentication']
Installed ...