char wrote:
>{% for user in object_list %}
> {{ user.user.first_name
>}}
>{% endfor %}
>
>
Use "user.get_user" instead of "user.user". This is the same method that
you use in your __repr__ just without parentheses (they aren't needed in
the template syntax).
Nicholas Matsakis wrote:
>I'm trying to get apache 2.2 to not rewrite my Django urls with a trailing
>slash using the "DirectorySlash Off" directive, but it seems to be
>ignoring it.
>
This is not Apache that does it since for Apache Django URLs are not
directories. This is Django itself:
Siah wrote:
>When I try to import utilityfunctions.py from my python console using
>the following command, it works just fine:
>
>from myproject.utility.utilityfunctions import *
>
>However, once I place this good looking import command inside my
>myproject/apps/polls/models/polls.py it gives me
Amit Upadhyay wrote:
On 2/15/06, *Maniac* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
It may be threading... What http server and what database you use? If
http is Apache does it use threaded worker?
Threading? Thats surprizing, I am using apache
Amit Upadhyay wrote:
How can I get more than one Blog when I am specifying pk. This happens
just once, while that page is accessed more than hundreads of times
everyday, I am getting a clean output when I do it on python prompt:
>>> from django.models.blogger import *
>>>
[EMAIL PROTECTED] wrote:
I was wondering, in response to more complex templating setups. If as a
user, you wanted to subclass a parent template, but the parent template
needs to dynamically generate content given a data source. An example
could be a calendar of events that you want displayed
Kenneth Gonsalves wrote:
I tried location as "/" and admin mounted as:
http://mydomain.com/admin/
admin comes up - but css is not found. On looking at the page source
of both it gives:
"/media/css/base.css/" in both examples, but in the second example i
get a 404 in the logs saying css not
limodou wrote:
If you are using the lastest svn, why your output is not the same as me?
Because 0.92 is a magic-removal branch, not the trunk which 'latest svn' is.
Maniac wrote:
Give them all the same name but different value.
Then when you submit a form browser will send values of checked
checkboxes and then in a view you can do
request.POST.getlist('myfield')
A typo: I meant 'myfield' and 'array' to be the same name but messed
them up
Waylan Limberg wrote:
I envision a simple script that intercepts the
upload submit, checks the actual file size against the specified limit
(perhaps in a hidden field or hard coded in script or even via an ajax
request (but why?)) and either returns an error message or submits the
upload.
No,
Tim TerlegÄrd wrote:
To get a non-editable field you can do field = meta.CharField(editable =
False). This is meant for hiding the field, right? Not to make it
readonly in code?
It means (as far as I know) that default manipulators will skip it and
won't complain about their invalidity. So
Amit Upadhyay wrote:
No time for investigating it right now, but existence of those
projects imply its doable, even if its a hack, atleast on some servers.
Hm... Yes, they do it with some patched FCGI code.
Amit Upadhyay wrote:
It would be good to have a general django wide setting specifying the
maximum length allowed for POST data, if underlying server allowed it.
Django just doesn't control these things. Read my answer in this very
thread, it's http-server and browser that don't let it
Adrian Holovaty wrote:
def isSmallFile(self, field_data, all_data):
if len(field_data["content"] > 1: # 10,000 bytes
raise validators.ValidationError, "Please enter a smaller file."
The trick here is to operate on field_data['content'] instead of
field_data.
hugo wrote:
It's not required to use chunked transfer, but to know the full size
before sending the content, you will have to generate the full content.
Sure, if it is some big static thing, you can just ask the filesystem,
but if the large stuff is created dynamically, you can't "just set
Julio Nobrega wrote:
Just add (concatenate? append?) another urlpatterns:
urlpatterns = patterns('project.apps.some_app.views',
(r'^some_url/$', 'index'),
)
urlpatterns += patterns('project.apps.another_app.views',
(r'^another_url/$', 'index'),
)
Thanks! I was actually thinking of this
Hi, everyone!
I have an urlconf file in my app with a convinient prefix to my view
functions:
urlpatterns = patterns('project.apps.app_name.views',
(r'$', 'index', None),
...
)
Now I want to use generic views in the same app and the prefix to my
views gets in the way being added before
Luke Skibinski Holt wrote:
I'm just looking for a quick way to update my models in the development
stage while keeping test data.
I once wrote how I do it:
http://groups.google.com/group/django-users/browse_frm/thread/251a42339efc79df/94ab85140ec35c97?lnk=st=3#94ab85140ec35c97
Alice wrote:
Is there a means to pass a template variable {{ user_id }} to a custom
template tag,
{% build_menu "user_id" %} ?
In fact you can treat anything after your tag name as you like, it's
just a string. But for such natural thing as treating it as a variable
Django will help. For
akaihola wrote:
Actually, the manipulator doesn't even know about the default values of
the model.
Why that? If you just create AddManipulator and get its flatten_data
you'll get default values of the model.
Your example is based on hidden fields with default values. However,
I've
akaihola wrote:
Ok, I'll take a look at the _pre_save() mechanism. By the way, isn't
that one of the things changing in magic-removal branch?
Yes, it goes away. Instead one would be able to override save() and do
everything in it.
I still wonder about the default values question though.
akaihola wrote:
So, if I'm not mistaken, the default values for a model's fields are
not used when saving an object,
They are used to prefill form elements in the Admin (don't know about
custom forms though, never tried). So it's just a hint for the user.
and I must create a custom
Alice wrote:
I'm trying to access the username of a journal post in a generic
object_detail/list view like this:
{{ object.poster.username }}
however I'm not getting anything whatsoever ... my model is
class Journal(meta.Model):
poster = meta.ForeignKey(User, editable=False)
patrick k wrote:
question is: how do i get a milestone_list for every project and what is the
best way to do this?
{% for project in project_list %}
{% for milestone in project.get_milestone_list %}
{{ milestone }}
{% endfor %}
{% endfor %}
In other words you can call object's
Batiste wrote:
Request Method:POST
Request URL:http://127.0.0.1:8080/publier-media/1/
Exception Type: TypeError
Exception Value: string indices must be integers
Exception Location:
/usr/lib/python2.4/site-packages/Django-0.90-py2.4.egg/django/core/validators.py
in isValidImage, line 144
A
Wilson Miner wrote:
I haven't got around to posting those with guidelines, but I've
attached a version you migth be able to use.
Thanks, I'll keep it!
Eric Evenson wrote:
This works, but I need to use a different css style for each field. By
default they both would use class=vIntegerField.
They also would have unique ids: "id_foot" and "id_bar". You can style
them in a style section of your HTML of in separate CSS file referencing
by
I'm writing a blog post about Django and want to use a logo as a
decoration. There are number of nice badges on
http://www.djangoproject.com/community/badges/ but they all have Django
logo with some text. Neither of them seem to make sense for just an
illustration.
So I'd like to ask
Waylan Limberg wrote:
I imagine that is why online
photo services (flickr) offer client side apps for batch uploading
etc.
Another way is to accept zip archives with pictures as a single file.
But it assumes rather educated users.
I'm currently doing such a service myself and for internet
PythonistL wrote:
Hello David,
Thank you for your reply.
I tried the demo but I think it has the same problem I described.
I registered ( as La ) and was logged in( so far so good).
But when I start another web browser window from and just open your
address again,
There is a thread in django-developers list talking about the way Django
and Rails handle frequent changes to models on early stages of
development ('prototyping' - to sound cool). Neither framwork does this
transparently which is understandable because it's definitely hard and
even arguably
Gwyn Evans wrote:
This specific issue is covered in the patch, but just for reference,
the 'gotcha' with rownum is that it's applied before any ORDER BY
clause is applied
I know :-). That's why I didn't use ORDER BY in my example :-).
, so in most cases, it's not going to do what you
want!
Afternoon wrote:
One idiom which is common is to intepret an empty password field to
mean "no change to password".
On a similar note...
It's also common thing to extract password change in a separate view. I
beleive it complies more with user interaction model because changing
some
Adrian Holovaty wrote:
The automatic manipulators set validator_list automatically, to some
automatic validation functions, but if you want to do things like
checking for uniqueness, you'll have to write the validator function
yourself.
Understood...
The idea was that declaring a field
Hi!
Automatic manipulators (ChangeManipulator, AddManipulator) have all
these nice things like uniqueness validation for fields that was
declared unique in a model. I'd like to use all this goodness in a
custom manipulator. Is it possible?
Adrian Holovaty wrote:
* The flatpages app: http://www.djangoproject.com/documentation/flatpages/
* The redirects app: http://www.djangoproject.com/documentation/redirects/
Looks like there are no links to these docs from the documentation index
stava wrote:
in the template doco there's some mentioning of other formats than
HTML, e.g. CSV and email.
Has anyone tried to use the django template framework for producing CSV
files or emails?
Does anyone know how that could be done?
It shouldn't be of any problem. Just make a template
Alice wrote:
yup, using Ubuntu. Added a password, changed the line, reboot and it's
still not working.
Ah.. My mistake. You should change 'local' line not the 'host'... I
actually changed both.
Alice wrote:
I'm trying to get my project working under mod_python but I'm getting
the error:
OperationalError: FATAL: IDENT authentication failed for user "alice"
Hi, Alice!
I had this problem and solved it on my Ubuntu Linux. Can't speak for
other Linuxes but Postgres from Ubuntu's
rapto wrote:
It might be a security problem. Probably Apache is set not to follow
symlinks
It's not Apache's thing. It's Python that searchs for Django modules and
can't find them. It might be just incorrectly created symlink.
I also don't think it could pose any security risc since Python
Abe wrote:
ImportError: No module named django
Looks like your Python installation doesn't see Django. Read this guide:
http://www.djangoproject.com/documentation/install/
Near the end in 'Installing the development version' item 3 should help
Andreas wrote:
mentioned that I don't, I'm using a custom model. Is there a way to
make a custom model available in all views and templates without
explicitly passing it as a parameter every time?
You could subclass django.core.extensions.DjangoContext and prefill it
with your everpresent
What's the recommended (if any) way to reference MEDIA_URL defined in
settings file from templates?
Admin site uses custom template tag for it. Is there anything similar
for general usage in projects?
Alice wrote:
unique_together = (("driver", "restaurant"),)
... and I don't think this is a db-level solution ..
At least in Postgres it is db-level. It produces something like this in
table definition:
CONSTRAINT polls_answers_driver_key UNIQUE (driver,restaurant)
Don't know
[EMAIL PROTECTED] wrote:
What I want is to be able to check that exactly 4 ansers have been
given and that only one of these 4 is listed as being correct
Anyone got any ideas on where I might start with this kind of thing. I
noticed validator lists for certain fields but wasn't sure that this
Maniac wrote:
2. The second problem is that rendered from {{
form.paper_type }} always sets default "selected" to the empty value
('') even if the paper_type has an actual value. Why that? In
admin interface for this model "selected" is set correctly
I'm fighting with what should be a very simple thing... I have a model
with some foreign keys and some plain fields:
class Picture(meta.Model):
album=meta.ForeignKey(Aldum) # Reference to some parent album
image=meta.ImageField(upload_to='',width_field='width',height_field='height')
Kenneth Gonsalves wrote:
i could - but why should i? every other list i subscribe to puts a list
name in [] - postgres lists, wxpython lists, linuxchix lists etc etc -
so why not you? - (this is not an attempt to start any flame war, but i
think it is common practice)
Yes it's common but
I can't figure out a very simple file upload. I have a simple model with
one-to-many relation:
class Dashboard(meta.Model):
name=meta.CharField(maxlength=20)
class Thumbnail(meta.Model):
dashboard=meta.ForeignKey(Dashboard)
image=meta.ImageField(upload_to='...')
1. First problem is that
jocknerd wrote:
Just updated Django to revision 632. Hadn't done anything with django
in a couple of weeks.
The model syntax has changed some time ago:
http://www.djangoproject.com/weblog/2005/aug/25/modelsyntax/
Adrian Holovaty wrote:
"django-admin.py sql" shows SQL statements for the given model module.
So if your models are split across multiple modules, you'll have to do
each one at a time.
Ah! That's why... The confusion is caused by django-admin.py saying in
--help that 'sql' command requires
Rachel Willmer wrote:
Next question, I'm building up a data model iteratively e.g. write a
bit of it, fix the errors caused by my lack of experience with Django,
go back and write some more...
Is there an easier way to do this than deleting the database each time
so the right tables/columns
Chris Ryland wrote:
I'm still learning Django, but it seems like you'd have an easier time
if you went with the general flow and simply used Django's ORM for
everything, rather than trying to do something special for this case.
This is what I'm trying to do.
I use Django's model objects
Hi!
I'm creating a model 'Print' with a field 'paper_type' that would
contain a value from a paper types list. As I understand I can make it
two different ways:
1. Create a PaperType table and refer to it from Print with a foreign key:
class PaperType:
name=meta.CharField(maxlength=20)
Thank you Adrian and Jacob!
Jacob Kaplan-Moss wrote:
It's actually very simple; all the "init" does is execute the
following commands:
...
May be it worth documenting somewhere?
Hi!
I've been struggling today with a problem. I've created Django's test
site some time ago before anonymous sessions has been added to Django.
Today I've 'svn update'd Django and when trying to access admin site got
exception about abscent core_sessions table. In the end I could managed
I wonder how Django's object-relational mapping handles update to
models? Let's say I want to replace one old field with two new fields.
Can this be handled more or less automatically? Will I lose values from
this one field, or whole table, or whole schema?
Jacob Kaplan-Moss wrote:
I just today ran across sqlrelay (http://sqlrelay.sourceforge.net/)
which looks *extremely* promising for this type of use. Does anyone
have any experience with it, and is there any interest in me writing
a sqlrelay backend?
We did :-). We tried to squeze it
Hello!
First, let me express obligatory excitement about Django. It's
fantastic! When programming with Delphi I always dreamed about some tool
that would generate classes representing DB tables in language syntax.
For it be possible to write just 'poll.pub_date', not
59 matches
Mail list logo