Let's say I have this data model:
class Workflow(models.Model):
...
class Command(models.Model):
workflow = models.ForeignKey(Workflow)
...
class Job(models.Model):
command = models.ForeignKey(Command)
...
Suppose somewhere I want to loop through all the Workflow objects, and for each workflow I want to loop through its Co...
I have some models I'm working with in a new Django installation. Is it possible to change the fields without losing app data?
I tried changing the field and running python manage.py syncdb. There was no output from this command.
Renavigating to admin pages for editing the changed models caused TemplateSyntaxErrors as Django sought to ...
From my Django application I want to serve up secure photos. The photos are not for public consumption, I only want logged in users to have the ability to view them. I don't want to rely on obfuscated file id's (giving a photo a UUID of a long number) and count on that being hidden in my media folder. How would I store a photo securel...
Here are some models I am trying to load data for:
class School(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
class RequirementSet(models.Model):
offeringSchool = models.ForeignKey(School)
name = models.CharField(max_length=200)
def __unicode__(self):
...
I have 2 models
class Vhost(models.Model):
dns = models.ForeignKey(DNS)
user = models.ForeignKey(User)
extra = models.TextField()
class ApplicationInstalled(models.Model):
user = models.ForeignKey(User)
added = models.DateTimeField(auto_now_add=True)
app = models.ForeignKey(Application)
ver = models.Foreign...
Hi Django people,
I want to build a frontend to a recipe database which enables the user to search for a list of recipes which are cookable with the ingredients the user supplies.
I have the following models
class Ingredient(models.Model):
name = models.CharField(max_length=100, unique=True)
slug = models.SlugField(max_length...
I'm thinking a bit about the concept of Django aggregates. I don't quite "get" how they can be used in my case. Basically i have a three-tier hierarchy of objects in my model, and the lowest object (Bar) contain values I want to aggregate.
class Bar(models.Model):
amount = models.FloatField()
class Foo(models.Model):
bars = mod...
Sometimes the best way to debug something is to print some stuff to the page, and exit(), how can I do this in a Python/Django site?
e.g. in PHP:
echo $var;
exit();
Thanks
...
Hi guys, i have a function that give me the result that im expecting in console mode, but if i try to use the function with Django, the page never load and just have a loop calculating and never end.
Any idea ?
*sorry with my english
Console function (WORK GREAT):
def sum_digitos(n):
sum = 0;
while n != 0:
sum += n % ...
I know this has been asked before, but I'm having a hard time setting up JS on my Django web app, even though I'm reading the documentation.
I'm running the Django dev server. My file structure looks like this:
mysite/
__init__.py
MySiteDB
manage.py
settings.py
urls.py
myapp/
__init__.py
...
I already set USE_L10N = True in settings.py
But in following view:
from django.contrib.humanize.templatetags.humanize import intcomma
dev view_name(request):
output = intcomma(123456)
Output is always "123,456" for all locales.
...
I have a problem that Django automatically adds slash to urls that ends with ".htm"
Url like:
http://127.0.0.1:8080/js/tiny_mce/themes/advanced/link.htm
becomes:
http://127.0.0.1:8080/js/tiny_mce/themes/advanced/link.htm/
But if I rename "link.htm" to "link.html" then no problem happens.
Where could be the issues?
Thanks.
urls.py:
...
I'm having some trouble figuring out the best/Djangoic way to do this. I'm creating something like an interactive textbook. It has modules, which are more or less like chapters. Each module page needs to list the topics in that module, grouped into sections.
My question is how I can ensure that they list in the correct order in the temp...
Hey,
I'm trying django-haystack with Solr and HAYSTACK_INCLUDE_SPELLING = True.
How do you access the spelling suggestions on the template (generated by the default SearchView) ?
Edit: another question: Can the Spelling Suggestion find words from the database ? For example, using the default Note model from the haystack doc, and the d...
I'm building a website in Django, and I want one of my datatypes to be a geographical polygon. I want to mark points on a map (say, in Google Maps) and then store the resulting polygon in the database.
Is there any way to do it that will save me the work of typing all the longitudes and latitudes manually?
I guess I'm looking both for...
I would like something similar to the string formatting from the standard library.
'%' Percentage. Multiplies the number
by 100 and displays in fixed ('f')
format, followed by a percent sign.
...
I am trying to create a simple view in Django & GAE, which will check if the user has a profile entity and prints a different message for each case. I have the program below, but somehow GAE always seem to return a object. My program is below
import datetime
from django.http import HttpResponse, HttpResponseRedirect
from google.appengi...
The site I'm working on involves teachers creating student objects. The teacher can choose to make it possible for a student to log into the site (to check calendars, etc) OR the teacher can choose to use the student object only for record keeping and not allow the student to log in. In the student creation form, if the teacher supplies ...
I've installed PostgreSQL and PostGIS, and now I'm trying to follow these instructions:
http://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#spatialdb-template
But I keep getting the following error, both in the command prompt and in Cygwin:
C:\Users\Home>createdb -E UTF8 template_postgis
createdb: could not connect to databas...
The only reason I can think of is that calculating ETag's might be expensive. If pages change very quickly, the browser's cache is likely to be invalidated by the ETag. In that case, calculating the ETag would be a waste of time. On the other hand, a giving a 304 response when possible minimizes the amount of time spent in transmission. ...