Django settings includes a list of python variables that are used for a plethora of things from database settings to installed apps. Even many of the reusable apps make some of the settings required.
With a dozens of sites, it is hard to manage the settings of all the projects.
Fortunately settings is just a python module with variable...
I have used a checkbox in my html template, On submit, i want to store these Boolean values into the MySql Table. Please advice me on, How should i code my views such that it accepts values from Templates and stores it to the database. Also suggest , if any alternative method is possible.
...
I'm trying to filter an object based off its first letter with:
topics = SpecialtyCategory.objects.filter(name__startswith=request.GET.get('filter'))
The problem is that the name could be "Example" or "example" and I want to get all SpecialtyCategory regardless of the case.
How do I do this?
...
So I have a huge list of entries in a DB (MySql)
I'm using Python and Django in the creation of my web application.
This is the base Django model I'm using:
class DJ(models.Model):
alias = models.CharField(max_length=255)
#other fields...
In my DB I have now duplicates
eg. Above & Beyond, Above and Beyond, Above Beyond, ...
In my Django app, I need to implement this "timer-based" functionality:
User creates some jobs and for each one defines when (in the same unit the timer works, probably seconds) it will take place.
User starts the timer.
User may pause and resume the timer whenever he wants.
A job is executed when its time is due.
This does not f...
Simple question. I have bunch of django views. Is there a way to tell django that for each view, use foo(view) instead? Example:
Instead of writing
@foo
@bar
@baz
def view(request):
# do something
all the time, I'd like to have
def view(request):
markers = ['some', 'markers']
and hook this into django:
for view in all_the...
I have two models: Activity and Place.
The Activity model has a ReferenceProperty to the Place model.
This was working fine until the Place table started growing and now
when trying to edit an Activity via django admin I get a memory error
from Google (it doesn't happen if I remove that field from the Activity
admin's fieldsets)
The wi...
Hi folk,
I'm using django-haystack at the moment
with apache-solr as the backend.
Problem is I cannot get the app to perform the search functionality I'm looking for
Searching for sub-parts in a word
eg. Searching for "buntu" does not give me "ubuntu"
Searching for similar words
eg. Searching for "ubantu" would give "ubuntu...
I put
print 'Hello world!'
into __init__.py in my django project. When I run ./manage.py runserver now, I get
gruszczy@gruszczy-laptop:~/Programy/project$ ./manage.py runserver
Hello world!
Hello world!
Validating models...
0 errors found
Why is __init__.py run twice? It should be loaded only once.
...
So I've finally successfully installed PIL (after many difficulties) on RHEL5 with Django (development version) and Python 2.6 installed at /opt/python2.6.
Running selftest.py shows that everything appears to be installed correctly:
$ python2.6 selftest.py
57 tests passed.
I can upload .png files and .gif files without difficulties,...
Hi,
can I access an image via a form-field in the template?
<p>
{% if field.errors %}
<span class="error">{{ field.errors }}</span>
{% endif %}
{{ field.label_tag }}:<br />
<img src="{{ field.value.url }}" /> {# <- This is what I want to do, I know it doesn't work like this #}
{{ field }}<br />
<span >{{ field.help_text }}</span>
<...
I run a Pinax-site for collaborative purposes. I added 'account.middleware.AuthenticatedMiddleware' to 'MIDDLEWARE_CLASSES' in order to not allow anonymous access to anything on the site.
But now I need public APIs to be enabled. Is there any solutions besides adding 'login_required'-decorator at all the views that still need to be priv...
We would like to use our own tables for user management instead of the Django "auth" tables. We already have database tables that include all of the relevant information our application needs but it isn't in the Django format. We would prefer not to have the information duplicated in two tables.
We would like to utilize the auth package...
I am sending emails to users using Django through Google Apps.
When the user receives emails sent from the Django app, they are from:
[email protected]
when looking at all emails in the inbox, people see the email's sender as :
do_not_reply or [email protected] depending on the email client used
If I log into that "do_not_...
I have a template that includes several tables. I want to use a sub-template which renders these tables in the same way. I can get it to work for a single table, by setting the context in the view and passing that to the template. But how do you change the data for to render another table for different data?
**'myview.py'**
from django...
(This is the django version of the thread at http://stackoverflow.com/questions/2111384/)
Suppose I have a table of customers and a table of purchases. Each purchase belongs to one customer. I want to get a list of all customers along with their last purchase. Can it be done without raw SQL and without multiple database queries?
...
Hi there - totally confused by now... I am developing in python/django and using python logging. All of my app requires unicode and all my models have only a unicode()`, return u'..' methods implemented. Now when logging I have come upon a really strange issue that it took a long time to discover that I could reproduce it. I have tried b...
I'm working with my hosting provider to get a Django application up and running, but neither of us are very experienced and we've basically hit a complete dead end.
I don't have direct access to the conf file but here's how its contents have been described to me:
<IfModule mod_wsgi.c>
WSGIScriptAlias /fredapp/ /home/fred/public_html/cg...
When I make an error in a django template {{placeholder}}, I get no error, just blank space in the output where I was expecting content. Is there a way to see something in my logs when this occurs, preferably using logging.warning or logging.error?
...
I would like to hear your opinion about this.
I have a django application, where the data obtained from the model are rough. To make them nicer I have to do some potentially complex, but not much, operation.
An example, suppose you have a model where the US state is encoded as two letter codes. In the html rendering, you want to presen...