Hi,
I started using django CMS project. It's great, built with modular design kept in mind... but what actually our customer wants is more simplicity:
Here, in django CMS every page can contain many content 'plugins' - be it text, image, or other. But the customer wants to have a text plugin active, selected and created automatically f...
I am looking for a good example of how to achieve the following:
I would like to use get_or_create to check whether an object already exists in my database. If it does not, then it will be created. If it does exist, then I will not create the new object, but need to raise a form error to inform the user that they need to enter different...
If there exists an old data of a model say ,
query=Emp.objects.filter(pk=profile.id)
Is there a easier way to copy the same values into the same model again..
Now that the id will be different so..
I have this requirement.
Thanks..
...
I've been using CakePHP for a long time now and feel comfortable developing sites with it. I do however like Python more then PHP and would like to move to Django.
EDIT: split in three separate questions
How can I mix multiple models in one form? I know formsets are used for this, but I can't find a decent tutorial on this (views + tem...
Hi folks,
is there a difference between using FAPWS3 and MOD_WSGI when dealing with Django?
FAPWS3 seems alot faster when serving requests toward Python scripts. I would like to know if I'm missing out anything. :)
Any ideas?
...
Hi,
I need to setup the same django project on several identical servers.
Details:
- os - free edition of oracle enterprise linux 5
- Apache / mod_wsgi
- python
- custom python2.6 installation
- oracle db with cx_Oracle
What is the simplest way to set it up?
Would you recommend creating a system user for the django project and use daem...
I have an SMTP server that requires secure password authentication (e.g. Outlook requires to check SPA). Is there a way to deal with it with Django SMTPConnection?
Or maybe ideas about any python solution to deal SPA?
Honestly, I couldn't find enough about SPA, to understand what is it exactly:
en.wikipedia:Secure_Password_Authenticat...
I am new to django and need some quick help.
How will the following sql statement be translated in django ORM?
SELECT * from table_name WHERE field1
= v1 OR field2 = v2
Thanks in advance!
...
I have a database table with e.g. a weight value e.g.
CREATE TABLE product (
id SERIAL NOT NULL,
product_name item_name NOT NULL,
.
.
weight NUMERIC(7,3), -- the weight in kg
.
.
CONSTRAINT PK_product PRIMARY KEY (id)
);
This results is the model:
class Product(models.Model):
.
weight = mode...
Hi,
I have a list of objects from a django queryset, e.g.
my_list = MyObject.objects.filter(variable=something)
MyObject has a field called year which is set to a particular year, e.g. 2005, 2007, 2009
I want to take my_list and create a dictionary of years which holds all MyObject values for that year. e.g.
my_dict['2005'] = list ...
Hi,
I has a Django view which is accessed through an AJAX call. It's a pretty simple one — all it does is simply pass the request to a form object and save the data. Here's a snippet from my view:
form = AddSiteForm(request.user, request.POST)
if form.is_valid():
obj = form.save(commit=False)
obj.user = request.user
obj.sav...
I've come up with a simple search view to search for records in my app. The user just enters all parameters in the search box then all this is matched against the database, then results are returned. One of these fields is the phone number....now in the database it's stored in the format XXX-XXX-XXX. A search, for example, for "765-43...
When you run syncdb in Django, the primary keys of the content types will be recomputed. If I create new models, the next time I run syncdb, the primary keys of the content types will be different.
If I have an application running in production, how can I update the database with the new models and keep the integrity of content type pk...
hi,
I'm doing some IP localization and need to set the language in a view.
Using translation.activate changes the language, but the rendered page
still have the default language prefix in its URL.
Is there any way to also change the rendered URL?
thanks
jul
...
OK I give up - after 5 solid hours trying to get a django form to upload a file, I've checked out all the links in stackoverflow and googled and googled. Why is it so hard, I just want it to work like the admin file upload?
So I get that I need code like:
if submitForm.is_valid():
handle_uploaded_file(req...
I've the problem, template for dynamic JS file is main.js located in TEMPLATE_DIRS. When I do ./manage.py makemessages -a all messages {% trans "MSG" %} are fetched but not from main.js template.
Of course I can rename main.js to main.js.html, is any pretty way?
./manage.py makemessages -d djangojs — dont help.
...
Hey guys/gals!
I had a question for you, something that I can't seem to find the solution for... Basically, I have a model called Environment, and I am passing all of them to a view, and there are particular environments that I would like to exclude. Now, I know there is a exclude function on a queryset, but I can't seem to figure out h...
my_event = Event.objects.get(id=4)
current_time = datetime.datetime.now()
How do I do check if my current time is between them?
my_event.start_time < current_time < my_event.end_time
...
I publish discount offers for my city. Offer models are passed to template ( ~15 offers per page). Every offer has lot of items(every item has FK to it's offer), thus i have to make huge number of DB request from template.
{% for item in offer.1 %}
{{item.descr}}
...
I've been using webfaction for all my django needs for the last couple of years but have had a high traffic site fall in my lap that dreamhost are probably better suited to handling.
To set up and experiment with a site with webfaction there are your [user].webfactional.com accounts. Which is sweet.
Equivalently Dreamhost also offers [...