I have a seach by name function, which should return the name of one person, if the search matches the first name or the last name. The problem is that if i search for strings like 'firstname lastname' it doesn't find the name that matches (guess it's because of the space between the words) . What should i do for the search to work?
Also...
i want to create some css styles for my Django templates. Each view will have a css associated, but there will be zones that are not associated to any views in my template.
How can i load the css files? is there enough having them declared in the Media of my view, and loading them in the header of the html?
Also, is it a correct approa...
Hi All,
I have to develop an application where I need to send sms to the users on a particular action by the users.
I have heard of kannel with PHP, is there some help for the same in Python as well or is there any other better open source sms gateway which I can use with my application?
Please suggest.
Thanks in advance.
...
How can I import models and views from Django Site1 to Site2 using the Sites Framework?
Django Sites Framework scenario
top
----site1
----site2
----media
#File on Site 2: views.py
from site1.article.models import Model1, Model2
...
is there another REGEX way (or another way) to ensure that a model class field would be unique? (it is not a key, or at least not declared as a key, is shoulb be a simple CharField)
Thanks
...
I'm trying to write a reverse relationship for taking the number of answers asociated to each question, but all i get is 'Negative voting' repeating as many times as the question is voted negatively, and i don't get why it doesn't display the number of votes instead of that.
my code:
{% for object in object.voteupanswer_set.all %}
Posit...
I have a complicated query built up based on a users profile, I start with
qset = Profile.objects
bunch of stuff that works to return me profile objects (it uses Q objects, and optionally ignores some fields if they were left blank)
I could grab the users with selected_related() but that still leaves me with a list of profiles, rath...
I have made some repetitive operations in my application (testing it), and suddenly i'm getting a very weired error:
OperationalError: database is locked
i've restarded the server, but the error persists...
What can it be all about??
Thanks!
...
I'm open to persuasion that this is a bad idea. But if not, here's the general draw:
Web interface to maintain data (django.contrib.admin).
Web interface to create pages (django.contrib.flatpages)
Web interface to create templates (dbtemplates)
Where is the web interface to create queries and define context? (contexts?)
EDIT
Here...
I`m trying to upload files to Django with SWFUpload. Found this article Django with SWFUpload. But found one problem. In Django 1.2 a csrf requires a csrf token to be send on every form submit, and it includes files that are send with SWFUpload.So uploading doesnt until i turn off csrf ( globally or for view using @csrf_exempt decorator...
I set my database to require ssl. I've confirmed I can connect to the db via command line by passing the public key [and have confirmed I can't connect if I do not pass public key]
I get the same error in my django app as when I do not pass a key. It seems I've not setup my settings.py correctly to pass the path to the public key.
Wha...
I have successfully used inline formsets to create a recipe input form that consists of a Recipe form (just a model form) and a RecipeIngredient formset. The models are:
#models.py
class Recipe(models.Model):
title = models.CharField(max_length=255)
description = models.TextField(blank=True)
directions = models.TextField()
...
Is it possible to limit django timesince filter say to 7 days.
If date is more than 7 days, don't apply the filter
...
The components of the URLs of the Django app I'm working on are very 'pluggable', and different combinations of them get used in various urlpatterns, so our urls.py looks something like:
rev = r'(/R\.(?P<rev>\d+))?'
repo_type= r'^(?P<repo_type>svn|hg)/'
path = r'/dir/(?P<path>.*)$'
# etc.
urlpatterns = patterns('',
(repo_type_param...
a newbie question
I have a Django project with two applications core and nagios each with its model
I have two database connections default and nagios
The nagios database is read only
when I use python manage.py syncdb this error appears
Table 'nagios.django_content_type' doesn't exist"
why does the contentType application need t...
Django 1.2 has brought in some changes in the syndication framework. According to this, I should now be able to do something like:
from django.conf.urls.defaults import *
from myproject.feeds import LatestEntries, LatestEntriesByCategory
urlpatterns = patterns('',
# ...
(r'^feeds/latest/$', LatestEntries()),
(r'^feeds/categ...
Django forms split based on model type
models.py
TYPE = (
('general', 'General'),
('category2', 'Category2'),
)
class Test(models.Model):
type = models.CharField(max_length=765, choices=TYPE)
forms.py
class TestForm(ModelForm):
class Meta:
model = Test
Is it...
I have the following piece of code overriding the save method of a model:
@transaction.commit_on_success
def save(self, *args, **kwargs):
try:
transaction.commit()
self.qa.vote_down_count += 1
self.qa.save()
super(self.__class__, self).save(*args, **kwargs)
except:
transaction.rollback(...
Hello,
I am making some view functions to calculate the rank of one user in a community.
My problem is that i want to display the rank afferent to each user, in its profile, and i don't know how, since i don;t have a request and a render_to_response (cause i guessed they are not needed)
my code:
def calculate_questions_vote(request):
...
I'm new to python and to django so this question will probably be easy to solve but I can't get it to work.
Basically I have a model which contains two foreign keys of User type. I'm building a form in which I want to remove one of the choices of a ModelChoiceField based on another field. I want the user to be unable to select himself in...