Or something I am doing
wrong?
Cheers
MerMer
def etag_test(request):
etag = "TestEtag12345"
if etag == request.META.get("HTTP_IF_NONE_MATCH"): # Check to see
if request has matching etag
return http.HttpResponseNotModified() # if etag matches send
a 304 repo
OK - I've found the problem. I'm using Firefox (Version 3.06) but the
problem is actually with Firebug, which I've been using to view the
headers.
With Firebug disabled, it works fine (viewing the headers through
another app).
--~--~-~--~~~---~--~~
You received
I am trying to change the Headers in the response.
My frustration, is that I can change the ETAG header and it is
returned by the browser at the next request but I can't seem to get
the Cache Control or Expire header accepted by the browser
Does anybody have a clue why? Is this a browser issue
Does anybody have any advise on how best to customize the Admin to
cope with large data sets.
We need to deal with 500K plus records - and the loading times are
just too slow.
Is it possible to show a limited number of recently added records ffor
a model, but then use the search facility in athe
Is there a way to display only the values of certain fields in the
Admin, so that it is clear that those fields are non-editable?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to thi
ck <
>
> malc...@pointy-stick.com> wrote:
>
> > On Tue, 2009-02-17 at 17:19 -0800, mermer wrote:
> > > Is there a way to display only the values of certain fields in the
> > > Admin, so that it is clear that those fields are non-editable?
>
> > You would
You need to create a custom ReadOnlyField that subclasses the
FileField.
You also need to create a ReadOnlyWidget that subclasses Forms.Widget
The link below, explains how the whole thing hangs together.
http://lazypython.blogspot.com/search?updated-min=2008-01-01T00%3A00%3A00-05%3A00&updated-m
Since I've upgraded to Django ver 1.00, I'm suddenly getting the
following error with my ImageFields.
The tag is {{ model.image.url}} and it throws an error if the image
field in the database is null (even if it is set to null in the model)
Am I missing something? Here is the error message bei
Anybody with any advice on this. Ever since wev'e upgraded to version
1.00 we are having issues with the ImageField
ValueError: The 'image' attribute has no file associated with it.
On 19 Feb, 12:30, mermer wrote:
> Since I've upgraded to Django ver 1.00, I'm sudd
This is a follow on from my previous email. Things have got even
stranger and unpredicable.
I dropped the table from the database and then ran syncdb to re-create
a completely new and empty db. However I STILL
cannot get the new fields to be recognized. All the previous fields
are available.
I can only assume that my path was
somehow faulty. However, that doesn't fully explain why Django was
using my model file perfectly ok in some instances (such as in the
Admin and in the DB), but not in the shell or through my views.
MerMer
On Mar 20, 12:04 pm, "Ramiro Morales" <[
Scratch that. Couldn''t see the wood for the trees. I was simply
missing the comma after Promotion.
MerMer
On Mar 27, 10:34 pm, Merric Mercer <[EMAIL PROTECTED]> wrote:
> Can somebody provide some guidance for how to use limit_choices in a
> Model. I am trying to
>
Thanks Russ,
Since my last post I've also discovered the the "values" option which
automatically converts the queery sets into a list of dictionaries.
data=MyModel.objects.values('field1', 'field2')
MerMer
On Apr 18, 12:48 am, "Russell Keith-Magee&
Many thanks Malcolm. That nailed it. So simple when you know how!
MerMer
On Apr 19, 2:56 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Wed, 2007-04-18 at 23:28 +0100, Merric Mercer wrote:
> > I'm have the following three Models.
>
> > 1.Category M
ing (but I suspect there must be a better way!)
ls=[]
for i in qs:
if i.newattribute == somevalue:
ls.append(i)
I am then return the list rather than the qs to the template.
cheers
MerMer
> Something more than what you think is going on here. This sort of simple
> example (ite
Many thanks Macolm that's very clear.
can't replicate the error any
> > longer - I do apologize for wasting your time.
>
> > However, one additional question.. is there an easy way to a record
> > from a queery set dynamically (without touching the DB)? What I'm
> > looking do do in my view is
kes the system ugly and unusable for me as an Admin
function.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.c
r.
Cheers
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL
= models.ManyToManyField(Promotion)"
to the Category Class it works fine!
This is driving me crazy, as a newbie it's not easy to diagnose where
the problem lies. I've been very impressed with the documentation,
review etc of Django - but after 24 hours of not getting too far, I
Thanks Jay and Rajesh,
I've just discovered this myself by switching the code around. This
is a real GOTCHA and not immediately obvious for a newbie like me. I
can't see anything in the documentation that mentions this - so I
presumed it was a bug.
--~--~-~--~~~--
Jay, I did read the documentation before jumping in - but it's not all
necessarily clear for someone who hasn't alot of experience in Python
of Django.
Because of my unfamiliarity I had presumed that all the classes in a
single Models.py were immediately visible to each other. There is
nothing
> I keep learning little bits here and there as I encounter them,
> but am having trouble fitting all the pieces together into a
> cohesive big-picture. Like the person to whose post I'm
> responding, I can read the docs, but extracting the big-picutre
> (which in turn would help in knowing whe
. However, this is only clear
once you have clicked on the header. Is there a setting to each column
head on automatically so it is visible?
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users&
that be enforced every time that Models Manager is called?
3. Many of the Meta Model options seem to be heavily linked to how the
data is to be viewed. Why isn't it in the View.Py instead? I'm
assuming that I haven't got the big picture on this.
MerMer
--~--~-~--~~
Malcom,
Many thanks. That's a big help.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubs
w_date','is_viewable')
Using the above code, the data for 'rating', within the Admin list
display is being shown as "(none)".
However, when I remove the choice=RATING_CHOICES, the data shows up.
This looks like a bug - can anybody explain this to me?
MerMer
Ray,
The code is below. The RATINGS_CHOICES are defined inside the Model
Class.
MerMer
RATING_CHOICES=(
('5', '5 stars'),
('4', '4 stars'),
('3', '3 stars'),
('2',
Many thanks, that sorted it.
Interesting to note that using the string format the data still got
stored in the Database and was getting displayed back in the admin
detailed view, but not in the list view.
MerMer
--~--~-~--~~~---~--~~
You received this message
e returned HTML shows that the
Javascript is being parsed correctly to where the files are stored.
However, I'm not getting anything. Anybody have any ideas where I
might be going wrong?
MerMer
--~--~-~--~~~---~--~~
You received this message because you
ying to find my way around.
MerMer
> Ok you've surely checked, but i have to ask anyway. :)
> Are the files really readable, e.g. does
> http://www.yoursite.com/media/js/textareas.js show up in your browser?
>
> Oh and which browser do you use? Konqueror (and probably Sa
Details are in the Database API document . The "exact" expression is
defined in the glossary thoough the example uses .get rather than
.filter
MerMer
carlwenrich wrote:
> it worked, thanks. where would i find it if you hadn't been so ki
jango.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROT
Another newbie question!
If I have two tags {{ objects.cash }} and another {{ objects.cash1 }}
can I add these together in the template?
If not which is the most appropriate way to manage something like this.
MerMer
--~--~-~--~~~---~--~~
You received this
to work. I've
installed these and checked that the HTML that is rendered by Django
points to the correct js files, but nothing is working.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users&quo
something else
I'm abit unsure about the best way to go an try and solve issues as I
encounter them.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, s
Thanks for all this, though I have to say right now I don't fully
understand many of these settings. Is this fully covered in the
documentation - if so where? I've looked in the Settings folder - am I
missing something?
Chee
c:/python24/lib/site-packages/django/bin/juicyoffers/mytemplates/polls/
',
'/mytemplates/polls/',
)
but this didn't work. Any suggestions?
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
hich are not child templates) which load fine within the promotions
directory and the polls directory.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, sen
I've now moved the parent template into the same directory as the child
template but I'm still getting the same error.
Exception Value:Template 'results.html' cannot be extended, because
it doesn't exist
Exception Location:
C:\Python24\lib\site-packages\django_src\django\template\
ghtly more complex example, which showed how
to create templates which draw data from different tables.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this gro
my settings look like the following:-
TEMPLATE_DIRS = (
"c:/python24/lib/site-packages/django/bin/mysite/mytemplates",
When I set up Django I just put in the full path in the belief that
this would make things easier while I was testing stuf
Julio,
I not sure what directory you're refering to. The tutorial is quite
explicit that one should create your own template directory within your
site. It wouldn't make any sense if these then had to refer to base
templates elsewher
The {% extends "promotion_list.htmt"%} is not working even when I moved
the promotion_list template into the same directory as the child
template.
I'm probably making some realy rookie mistake - but I can't see it.
MerMer
--~--~-~--~~~---~--~~
You rece
Frankie,
Thanks for this... I'll take a look.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To u
hink I'm also
having issues with those.
Cheers
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubsc
I can see that I could use inclusion tags or template tags. I've read
the documentation however, I'm still unclear when you would use one
over the other.
What would be the appropriate use case for a template tag versus an
inclusion ta
te.
The author states, that based on the code below, I would need to add
{% get_latest_polls 3 %} to the template, where 3 is a variable.
However, while this not not create any errors, it is also not returning
the latest 3 Polls. What else do I need to add?
MerMer
from django impor
Tim,
Many thanks - that works a treat. I was getting myself very confused
about where and how to use the context.
Cheers
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
. I'm very new to both Python and Django.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsu
Jonathan,
Many thanks for this.
Sorry to be a pain , but I have a couple of follow on questions, so I'm
clear.
1. How should I best implement this code. As a custom tag or in the
view?
2. Any suggestions on how I should pass the product.id to the code?
Thanks
M
$24 2 4.5
Product 2 $20 0
Sorry if my orginal post wasn't clear enough on this point. Will your
solution still work on this basis? Many thanks.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are sub
Also, if anybody can advise me on how I get
the division to work - that would also be appreciated - Django returns
a Zero Division error.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users&quo
Tim,
Many thanks - that has helped me understand alittle more about Python.
I'm sure that there is a faster way. It's been more of an exercise
for me to try and get to understand Django, Python etc. I'm practically
a complete newbie.
Any suggestions on how would you get the server to calculate
John,
Excellent. The requirement to make it easily sortable makes your
solution compelling. Thanks for detailing. Plus Im sure that there will
lots of places where this type of Signals method would be handy.
MerMer
--~--~-~--~~~---~--~~
You received this
Ian,
Great screencast. As a newbie - very helpful and I'm looking forward
to seeing more content on the site when it launches.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this
Does anybody know of a filter/tag that will return a table list with
rows of an alternate color.
I have a hazy recollection that I've seen this somewhere - but I've
relooked through the documentation and can't seem to find it.
MerMer
--~--~-~--~~~-
in
the products directory.
However, whenever I run this I get an import error. I just can't
figure out where I could be going wrong. Any ideas?
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django
e app "products" (which is home to
the models.py file where Product sits and home to signals.py) AND the
promotions app - which has the following import statement:-
from myapp.products.models import Promotion, Review
Cheers
MerMer
--~--~-~--~~~---~--~--
Apologies but
"from mysite.promotions.signals import update_review_average" should
read "from mysite.products.signals import update_review_average"
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Go
have further questions come back. In the meantime, I've resorted to
putting the "update_review_average" into the models.py - which has
created a new set of problems (see new post).
As a newbie, I'm struggling to make much headway - guess it's not my
day!
MerMer
--~--~---
lter(id=promotion_id,)
p=p_qs[0]
p.av_rating = average
p.save()
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.c
o and Python and and with limited experience in PHP
I'm finding it very slow going... though I'm trying to persevere.
MerMer
TypeError at /admin/promotions/promotion/
__str__ returned non-string (type long)
Request Method: GET
Request URL:http://localhost:8000/admin/promot
I've managed to sort it... I had inadvertantly set one of the classes
to
def __str__(self):
return self.id
which obviously caused the conflict. Apologies for wasting anybody's
time.
MerMer
--~--~-~--~~~---~--~~
You received this message b
Zak,
Many thanks - exactly what's required. In hindsight its so obvious - I
don't know why I was making such heavy weather of it!
Cheers
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
&qu
Looks very interesting. Good to see some more information about
deployment with other options.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, sen
Since a many-to-many relationship is effectively a join table of two
1-many relationships can you implement a many-to-many relationship like
this in django like this? Any problems associated with this approach?
class A
class B
foreignkey(A)
foreignKey(C)
class C
MerMer
Many thanks Aidas, I'm having a play around to see. As a follow-on
do you know how I can make table B appear in the Admin - if I use a
many-to-many reference directly from A to C instead.
If I do this, I understand that Django will automatically create the
join table, but how do I get it to d
the post.save method. Would that be right?
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe
I am trying to extend the User Model.
I've created a new app (userprofiles) and added this to my settings.
I've then created the models.py (see below)
At first II tried the following (User, unique=True,
edit_inline=models.TABULAR, num_in_admin=1,min_num_in_admin=1,
max_num_in_admin=1,num_extra_o
In the example below I am trying to get list_display to show the the
"fullname" that was defined in def__str__(self). It's not working.
Can anybody tell me how I can do it.
Many thanks
MerMer
class UserProfile(models.Model):
user=models.OneToOneField(User)
Thanks for the input - but I still can't get it to work. With the code
as above I get an error
saying the attribute "self.fullname" cannot be found. When I try
"list_display = ('fullname')
I get the following error
"__str__ returned non-string
Using the following code I am only getting 1 object returned in the
admin list for UserProfile.
So if I have 5 objects - I get 4 blank lines and then 1 line with the
listing.
class UserProfile(models.Model):
user=models.OneToOneField(User)
def __str__(self):
return "%s %s"
Duhhh! So busy looking for problems that I forgot to look for the
obvious.
My apologies for wasting time.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this g
I moved to creating the model with a OneToOne relationship rather than
a foreign key and have it got it to work. Not sure why I was having
problems as Foreign Key
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Dj
I've looked through the official docs regarding sending an email but I
can't find any explanation on how to point to a particular SMTP server.
How to I set up the SMTP server so that the send_mail function works?
MerMer
--~--~-~--~~~---~--~~
You rec
it as required on
each view?
Second, will I need to render a dictionary of values - or can I put
session information directly into a template?
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users"
Thanks Don, I've now found it. As default, the setting file had not
been set up with an Email_host which is why I missed it.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users"
I had orginally heard that the book was due out in October - but when I
last looked at the Apress site it mentioned January. I also noticed
that the Archives had not been updated.
No criticism mind, I'm well aware that Django is a volunteer effort -
however, it's extremely reassuring to hear t
I am trying to get the Logout Method to work, but I keep
getting"Exception Value:maximum recursion depth exceeded!".
The view is very straightforward, so I can't understand where I'm going
wrong.
from django.contrib.auth import logout, authenticate, login
def logout(request):
logout
ile fields (having
pre-populated thhe UserProfile session fields when the user logs on).
What are the pros and cons of each method. By using Sessions will I
avoid hitting the DB as much as method 1?
Cheers
MerMer
--~--~-~--~~~---~--~~
You received this message b
model manager.
2. In trying to learn Django and python - I'm trying to discover how
everything works. Django seems very powerful but it is not immediately
intuitive which of the possible options (views, template tags, models
and managers etc) one should use.
M
Cheers Aidas, that's wokred for me too.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubs
zzz
2 100 Reg
2 100 xyz
Cheers
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroup
any way?
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL
Many thanks, Rajesh. I'll take a look.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubs
Joe,
My orginal code (see the inclusion tag below ) was returning a Query
Set and an interable list. I can't understand how I can loop through
the Query set and append the data to the end - as there is no matching
attribute in the Query set.
I am looking to return a query set and build a tabl
I found out that I needed to change the query set to a list, then I
could append new data to the end and return this. The following is the
ammeded inclusion tag.
@register.inclusion_tag('cashtransfer.html')
def show_cash_transfer(username):
balance=[]
x=0
y=0
qs=CashTransfer.obje
are on.
Anybody, have a way to do this?
Secondly, is there a way to use a form as an inclusion tag - and still
use custom manipulators.
Do I pass the details of custom manipulator etc back to the template
from the inclusion tag?
Cheers
MerMer
related_brands = Parent.objects.filter(brand=brand)
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscr
Thanks Zac, that's exactly what I needed.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubs
otal_value
>> 2000
However, I can't work out how to save a different value to the field
using something like
Promotion.competition.total_value=3000
Can anybody please advice.
Cheers
MerMer
--~--~-~--~~~---~--~~
You received this message because you are sub
stupid, but can't see it.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group
or me. Intuitively,
it should.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send
As this is handled by the browser - you might want to revert to
Javascript. I think there is a plugin for JQuery which handles this.
MerMer
Siah wrote:
> Hi,
>
> I need to hide referrer url on HttpResponseRedirect. I was expecting to
> find something like Re
code base
under tests/regressiontests/forms/tests.py.
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To u
I had a similar problem the other day. I had made a mistake on one of
my fields of another model, which was edited inline via the User Model.
MerMer
[EMAIL PROTECTED] wrote:
> I just know there's a simple explanation for this, but my brain is
> fried.
>
> My admin area dec
Yes, I broke the model that was being edited by the USER model. From
memory mine also validated OK, because the problem lay with some of the
data in the DB - not the actual structure of the model. That's why I
was able to see a complete USER list and only got the error when I
clicked on the i
There was a very recent post on CAS (Central Authentication System).
The author has written the middeware for Django and is making it
publically available.
I've no idea if there are any differences between CAS and OpenID, but
thought it might be worth a mention.
M
You can add "editable=False" to you database model. This prevents it
from showing up in Admin, though of course it can still be edited
directly in the DB.
MerMer
Ross Burton wrote:
> Hi,
>
> Is it possible to have fields in the model that can be set at object
> creat
ed the full URL but
have not got any further.
The URL works fine in a normal browser and in the manage.py runserver
window it shows a status code of 200.
Anybody have any ideas of where I'm going wrong with the Test Client.
MerMer
--~--~-~--~~~---~--~~
You re
1 - 100 of 108 matches
Mail list logo