for field in FIELDS:
row = []
row.append("<tr>")
row.append("<td>" + str(myform.fields.get(field)) + "</td>")
row.append("</tr>")
custom_fields.append("".join(row))
When I give the custom_fields variable to the template, all I'm getting is:
<tr><td><django.forms.widgets.CheckboxInput object at 0x1fa7d90></td></tr>...
'Ello, all. I'm trying to create a model in Django based on - but not subclassing or having a DB relation to - another model. My original model looks something like this: it stores some data with a date/time stamp.
class Entry(Model):
data1 = FloatField()
data2 = FloatField()
entered = DateTimeField()
I'd also like ...
Where can i get the technical manuals/details of how django internals work, i.e. i would like to know when a request comes in from a client;
which django function receives it?
what middleware get called?
how is the request object created? and what class/function creates it?
What function maps the request to the necessary view?
How d...
I need to convert a date from a string (entered into a url) in the form of 12/09/2008-12:40:49. Obviously, I'll need a UNIX Timestamp at the end of it, but before I get that I need the Date object first.
How do I do this? I can't find any resources that show the date in that format? Thank you.
...
I created custom django-admin commands
But, I don't know how to test it in standard django tests
...
I was wondering if there is already a way to create a separate autoincrement-ID-per-user field in Django?
Basically, I'm storing many related models and I need the IDs generated to be autoincrement per user.
I don't want to change how id works, just need a new field that I can add which is unique=True per user.
Any suggestions (other ...
What’s the best way to keep related files together in Django?
In addition to our HTML templates, most views have at least one additional JavaScript file, and possibly an additional CSS file. For example:
item_detail.html
item_detail.js
item_detail.css
We want to keep these files side-by-side if possible, so we don't have to look in ...
I have a series of applications which use one model and are all under one site. Essentially a mix of the main website, and public and private api's. Is there a way to make different DJango apps use a different tcp port? I have not been able to find anything in the documentation about it.
...
Hello, I'm working on a django app where the user will be able to upload documents of various kinds. The relevant part of my models.py is this:
class Materials(models.Model):
id = models.AutoField(primary_key=True)
id_presentations = models.ForeignKey(Presentations, db_column='id_Presentations', related_name = "materials_id_pre...
I can edit a parent child relationship using the TablularInline and StackedInline classes, however I would prefer to list the child relationships as a change list as there is a lot of information and the forms are too big. Is there an inline change list available in DJango admin or a way or creating one?
...
I'm a newb to the Python world and am having the dangest time with getting sessions to work in my web frameworks. I've tried getting Beaker sessions to work with the webpy framework and the Juno framework. And in both frameworks I always get a KeyError when I try to start the session.
Here is the error message in webpy (its pretty mu...
I'm just working my way through Django, and really liking it so far, but I have an issue and I'm not sure what the typical way to solve it.
Suppose I have a View which is supposed to be updated when some complex Python object is updated, but this object is not driven by the database, say it is driven by AJAX calls or directly by the use...
I have two models in Django: groups and entries. Groups has a many-to-many field that connects it to entries. I want to select all entries that have a group (as not all do!) and be able to access their group.title field.
I've tried something along the lines of:
t = Entries.objects.select_related().exclude(group=None)
and while this ...
So what exactly is Django implementing?
Seems like there are
Models
Views
Templates
Models = Database mappings
Views = Grab relevant data from the
models and formats it via templates
Templates = Display HTML depending on data given by Views
EDIT: S. Lott cleared a lot up with this in an edit to a previous post, but I...
hello
I used : SplitDateTimeWidget to split DateTime field ,
appointment = forms.DateTimeField(widget=forms.SplitDateTimeWidget)
In the template side i manage to use datePicker and TimePicker for each field , using jQuery .
When i try to filter the entries regarding to today date as in this code :
d = datetime.date.today()
entries...
How can I be certain that my application is running on development server or not? I suppose I could check value of settings.DEBUG and assume if DEBUG is True then it's running on development server, but I'd prefer to know for sure than relying on convention.
...
Previously had a go at asking a more specific version of this question, but had trouble articulating what my question was. On reflection that made me doubt if my chosen solution was correct for the problem, so this time I will explain the problem and ask if a) I am on the right track and b) if there is a way around my current brick wall....
It is well and good that the server restarts automatically for each change in the code. How would you have even the browser refresh automatically, as per configuration (Turn on and off, the least).
How to do it on Windows, and on Linux, for all different development frameworks.
What existing packages allow you to do it, and if you are ...
Hello
On sunday, I had problems with python modules, when I installed stackless
python. Now I have compiled and installed :
setuptools & python-mysqldb and i got my django project up and running
again. (i also reinstalled django-1.1),
Then I compiled and installed, jpeg, freetype2 and PIL. I also started
using mod_wsgi instead of ...
I'm writing a quick Django module and want to check for another module. Is there's a shortcut to check if another module is in the installed_apps list in Django's settings?
...