model:
class Product(models.Model):
name = models.CharField(max_length = 128)
(...)
def __unicode__(self):
return self.name
class Receipt(models.Model):
name = models.CharField(max_length=128)
(...)
components = models.ManyToManyField(Product, through='ReceiptComponent')
def __unicode__(self):
return self.nam...
Hi all,
Can anyone please help me sending html email with dynamic contents. One way is to copy the entire html code into a variable and populate the dynamic code within it in Django views, but that does not seem to be a good idea, as its a very large html file.
I would appreciate any suggestions.
Thanks.
...
Hello
I have one project that in my own development computer (uses mod_wsgi to serve the project) caused no problems. In live server (uses mod_fastcgi) it generates 500 though.
my url conf is like this:
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.con...
I am looking for a comparison of django and flask for a project that will live for a long time, and will need to be maintained, built upon and grow as the months progress.
I am considering Flask + SQLAlchemy or django.
I do not need batteries, as I usually end up having to modify them, so it is fine if I have to re-implement a couple o...
Hi,
I'm at the moment working on a web page where the users who visit it should have the possibility to create an event in my web page's name. There is a Page on Facebook for the web page which should be the owner of the user created event. Is this possible? All users are authenticated using Facebook Connect, but since the event won't ...
I need to do some debugging, because the permissions for one of my models are created wrongly. So I tried to find the piece of code where Django creates the permissions upon syncdb and writes them in the database, but I haven't been successful at all; maybe I just overlooked the right lines of code, but if somebody can point me out the r...
I've a large number of models (120+) and I would like to let users of my application export all of the data from them in XML format.
I looked at django-piston, but I would like to do this with minimum code. Basically I'd like to have something like this:
GET /export/applabel/ModelName/
Would stream all instances of ModelName in applab...
My code in the view:
from django.contrib import messages
messages.add_message(request, messages.INFO, 'Hello world.')
I don't want to show this code to the user the second time if he/she refreshes again. How do I go about doing that? Messages don't seem to have any sort of expiry setting. There is documentation here:
http://doc...
Hi All,
I'm a little stuck trying to get my head around a django template.
I have 2 objects, a cluster and a node
I would like a simple page that lists...
[Cluster 1]
[associated node 1]
[associated node 2]
[associated node 3]
[Cluster 2]
[associated node 4]
[associated node 5]
[associated node 6]
I've been using Django for about ...
Does anyone know of a widget that displays 2 select boxes. One shows a list of all object in a model and the other shows the objects which have been selected. The user can then select an object from the first list, click an >> button which moves it to the 'selected' list. Then when the form is saved the objects in the selected list ar...
I need to send a SOAP message (with Python SUDS) with strings encoded in 'iso-8859-2'.
Does anybody know how to do it?
SUDS raises the following exception when I invoke a method on a client with parameters encoded in 'iso-8859-2':
File "/home/bartek/myenv/lib/python2.5/site-packages/suds/sax/text.py", line 43, in __new__
result = su...
I have the same conundrum as presented in this question, but applied to Django's auth.User.
I have this proxy model:
class OrderedUser(User):
def __unicode__(self):
return self.get_full_name()
class Meta:
proxy=True
ordering=["first_name", "last_name"]
And some of my other models use an OrderedUser i...
Hey,
I need to deploy my Django application on my apache server, I've added the following to my httpd.conf:
<Location "/dashboard/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/home/firas/project/trunk/dashboard/analytics','/home/firas/project/trunk/dashboard', '/home/firas/project/...
How do I pass a query string from a response, meantime the relative template should also get loaded.
ex:
http://www.domain.com/test/?id=23423424
and id=23423424 is a key that is saved in the DB, so need to attach this when processing the response.
Thanks.
...
I have an admin page with inlines. In each inline, I want to put some custom text with link to the regular admin page for the object from that inline. Is this possible without customizing/hacking admin templates?
...
I have a website tracked using Google Analytics. It is a Django-based website, so all the URLs are "friendly" URLs (e.g., /my/friendly/url/) and don't have associated files like index.html, etc. Should the "default page" option in Google Analytics be left blank or set to /?
...
I just wanted to hear on the different general learning paths people embark on when learning a new language/framework.
The one I currently use, which is how I learned Bash and am currently learning Python, is:
instant hacking tutorial (very short
tutorial introducing the basic
syntax, variable declaration, loops,
data types, etc. and ...
I have a dictionary called number_devices I'm passing to a template, the dictionary keys are the ids of a list of objects I'm also passing to the template (called implementations). I'm iterating over the list of objects and then trying to use the object.id to get a value out of the dict like so:
{% for implementation in implementat...
Here's a common situation that I have and wish to avoid creating tedious loops and fiddling with html tables:
I have a model Movie, which is has fkeys to Director and to Genre.
How can I elegantly render a simple data table that has on one axis the different Directors, on another axis the different Genres, and inside each cell the coun...
Concept:
Drinks are made of components. E.g. 10ml of Vodka. In some receipt the component is very particular (10ml of Finlandia Vodka), some not (10 ml of ANY Vodka).
I wonder how to model a component to solve this problem - on stock I have particular product, which can satisfy more requirements.
The model for now is:
class Receipt(m...