What is the preferred way of storing generated content into file
models?
class Chart(models.Model):
xml = models.FileField(upload_to='charts')
...
I would like compute the image on the fly, using some data in the
database. How should I store the generated data? How should I use File
stor
Thanks for the quick reply. I have had request.FILES in there; my
problem was I misspelled the field name in the template.
My question is still the same though; is this the right way to work
with ImageField (FileField)? I still feel this is awkward. One has to
call methods on the model instead me
I used to store images in the database. Now I want to store them on a
disk. I have the following model:
class User(models.Model):
image = modes.ImageField(upload_to='userimages')
...
then, I have a new form like
class Information(forms.Form):
image = forms.ImageField(required=False)
What is the best way of adding query parameters (aka GET parameters)
to a URL?
return HttpRedirect(reverse('animal-search') + '?q=%s&page=%d' %
(animal.name, current_page))
seems awkward to me (not to mention escaping the name). How can I
avoid creating query parameters manually? Or, should I av
That is actually the same :-) However neither
Author.objects.filter( Q(name='Jiri Barton') |
Q(article__title__icontains='revealed'))
works. :-(
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google G
__str__(self):
return self.name
Now, onto the action:
--
In [10]: Author.objects.create(name='Jiri Barton')
In [11]: Author.objects.filter(name='Jiri Barton')
Out[11]: []
In [12]: Author.objects.filter(name='Jiri Barton&
> Redirecting to a GET with data is a fairly eclectic edge case, and I
> can't say I'm a huge fan of an assertion statement modifying the
> variables it is asserting.
I have but to agree with both statements. Let's leave it the way it
is.
> I'm inclined to put this in the 'not a common use case'
Another thing. I don't know if that's legal or not but I'd also need
to check the query:
self.client.post('/usermanagement/users/create/', {
'firstname': 'Sherlock',
'lastname': 'Holmes',
})
redirects to
/usermanagement/users/filter/?edit=1
(I use some search fi
I could live with doing multiple checks. In fact, I may want to check
every URL in the redirecting chain to make sure the flow is just what
I wanted.
Then, I can just hard code the URLs in the chain:
response = self.client.get('/page')
self.assertRedirects(response, '/first/') # no need to retu
Thank you Russ, that has fixed the problem.
I have a problem with the fix though; what if there were multiple
redirects? This just happened when I jumped to use your fix today:
/usermanagement
redirects to
/usermanagement/
which redirects to
/usermanagement/users/
in my application. I don'
You can use the YAML serializer until this is fixed. It worked for me.
You will have to install PyYaml first (http://pyyaml.org/) - or
easy_install pyyaml.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django use
Why does assertRedirects of TestCase succeeds only if the response
code is 302? One would think any 3xx should do - they are *redirects*
at all. At least, I would think 301 were okay because that is what
django.views.generic.simple.redirect_to generates.
How am I supposed to think about that? Whe
Why, I thought Person.position would be the straightforward way. I
mean that was the first thing that came to my mind - I have a class
and its attributes. So, the class name + dot + the class attribute
name.
I thought, well, if Django can detect I'm accessing a class attribute
and throw an excep
Is there a way of accessing fields of a model?
I have
class Position(models.Model):
class Person(models.Model):
position = models.ForeignKey(Position)
Now, I'd like to get to this position member. Is there another way
besides the following *oh my*:
Person._meta.get_field('positio
I wonder if someone could point me to an article that explains how to
document an existing web application. Or, do you know about an
application that is well documented?
It looks as if it were simple; I need my user to be able to understand
the flow from one page to another, under what circumstan
Hello girls and boys,
how do I check if a variable is None in a template? The following do
not work...
{% ifequal variable None %}
{% ifequal variable|default_if_none:"skip" "skip" %}
I want to be able to discern among None, empty list, and non-empty
list; then, I want to tell the user - say n
Hello there,
I want to display a checklist dynamically:
1 apple [ ]
3 pears [ ]
8 plums [ ]
([ ] stands for checkboxes)
The items are generated on the fly. I can create the form fields in a
manipulator __init__ dynamically, such as in:
for item in items:
self.fields.append(CheckboxField(f
The javascript language itself (plus browser javascript interface -
this is rather messy IMHO):
http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/
I have found the following reference very valuable. It describes the
MSIE web browser javascript interface. Surprisingly, it is from
Microso
How do I switch (change) the related object in a many-to-one
relationship? I'd like to have something like set_related_objects in
many-to-many relationship...
class RoomType(meta.Model):
description = meta.CharField(maxlength=30)
class Room(meta.Model):
number = meta.CharField(maxlength=
Thank you very much. This is exactly what I've been looking for.
I have two text input fields in a form. At least one of them is
required. My question is, how can I check for this?
class MyManipulator = (formfields.Manipulator):
def __init__(self, request=None):
self.fields = [
formfields.TextField(
field_name='apples',
I would like html2python be instance method. Consider the following
RelaxedDateField class which can accept date in various formats. It can
use day, month, and year from another date (reference date) if they are
not provided. The following inputs are valid:
27
2006-27-01
27.1.2006
27.1.
27-01
Th
I don't know if I'm getting it all right... The test cookie's age is
the same as the age of any other cookie.
My application is using views/auth/login.py, SESSION_SAVE_EVERY_REQUEST
= True, and SESSION_COOKIE_AGE = 600.
Let's have the following scenario. A user logs out of the application.
This
Wow, dorodok, that is elegant, indeed. I have already implemented by
the inclusion_tag as the guys suggested, but I'm going to do it the CSS
way.
Robert: autocorrected it to register.inclusion_tag in my code already
:-) thanks
Jiri
I like it!
Thanks
Hello there,
I have the following problem. Here's my template fragment; it defines a
menu:
mushrooms
cheese
tomatoes
onion
Now, I'd like to be able to highlight one item in some templates, and
another item in other templates. Only the templates know what should be
highlighted.
The format is reStructuredText, also referred to as reST or rst. You
can transform it to HTML using docutils. You can learn more about this
and the format at http://docutils.sourceforge.net/rst.html HTH, Jiri
I am struggling with the builtin authentication interface. I have
initialized the tables and entered some data in the authentication
tables. I have a couple of questions though,
(A) I want to use django.views.auth.login.login. I have entered this in
the url patterns. The implementation of this se
28 matches
Mail list logo