Help! Completely stuck with this one. Everytime I try to view any
table in the Admin I get an error.
I am getting a KEY ERROR with exception value of 'perms':
Exception Location: C:\Python25\Lib\site-packages\django-trunk\django
\template\context.py in __getitem__, line 43
Anybody have any
I have a template that uses {% for i in prize %} {{ i.description }}
{% endfor %}
This iterates fine in Firefox, but in IE7 it keeps coming up blank.
I can't see any html issues. I am working off my localhost. Is this
a IE7 security issue or something else I have not thought of?
Cheers
Mer
I've commented out all the HTML on the template, so my template now
reads as follows
{% for i in prizes %} {{i.id }} {% endfor %}
There is nothing else on the page except the commented out HTML.
In firefox this displays without any problem, in IE7 I get a blank
page, even when looking at the
It was a cookie issue. I had looked over this... but missed it on
first glance. My apologies
MerMer
On Feb 21, 4:17 pm, merric <[EMAIL PROTECTED]> wrote:
> I've commented out all the HTML on the template, so my template now
> reads as follows
>
> {% for
I can't get cache to work inside a view. Can anybody point out where
I'm going wrong
In my settings file I have the following:-
CACHE_BACKEND = 'locmem:///'
The view is as follows:-
def offers(request):
from django.core.cache import cache
cache_time=60*60*24
cache_name = "offers"
On futher testing I am getting some very weird results.
On occasions the cache key seems to get created, but expires almost
immediately, so the next time through the "cache_working" returns to
"NO".
--~--~-~--~~~---~--~~
You received this message because you ar
I've just tried updating to the latest development version and the
admin no longer works. I get the following message whenever I try to
access a DB via the admin:
ViewDoesNotExist at /admin/
Tried help_no_cookies in module promotions.views. Error was: 'module'
object has no attribute 'help_no_c
Thanks James, I'll have a look.
On Mar 3, 4:50 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Mon, Mar 3, 2008 at 10:29 AM, merric <[EMAIL PROTECTED]> wrote:
> > There is no VIEW called "help_no_cookies" in the promotions.views
> > modu
The problem seems to be with LOCMEM.
I changed the CACHE_BACKEND setting to a DB and cache worked fine.
In LOCMEM the cache seem to get set OK, but then cannot be retrieved
correctly. I don't get any error messages, it just doesn't want to
work. I tried this on two different machines, one ru
erms__exact =
> 'term2') & Q(terms__exact = 'term3))
>
> On Sep 14, 6:46 pm, Merric Mercer <[EMAIL PROTECTED]> wrote:
>
> > I have a model "OFFER" that has has many to many relationship with a
> > model "TERMS".
>
> > Class
Does anybody recommend a good workaround - I'm experiencing the same
problem
On Aug 25, 1:57 pm, Djon <[EMAIL PROTECTED]> wrote:
> Is there a ticket for it on the Trac?
> How/where can I monitor it so that as soon as a fix is available I
> could get the changeset?
>
> Thanks!
>
> On Aug 21, 11:4
e attribute of term that contains 'ThemePark' and 'London' ?
> What are you trying to end up with, all records with themePark or only
> records with themepark and London ?
> -richard
>
> On Sep 16, 11:36 am, merric <[EMAIL PROTECTED]> wrote:
>
> > I c
lter(Q(terms__term__exact = 'ThemePark') &
> Q(terms__term__exact = 'London'))
>
> -richard
>
> On 9/17/07, merric <[EMAIL PROTECTED]> wrote:
>
>
>
> > I only want records that have both the terms, "ThemePark" AND "London"
>
&
I am having real problems with IE6 and HttpResponseRedirect, IE keeps
showing a blank page, while Firefox works absolutely fine.
Has anybody else come across this issue ?
Thanks
MerMer
--~--~-~--~~~---~--~~
You received this message because you are subscribed
We've taken the approach using cookies. The value of the cookies is
returned to the template via a simple context processor. Each
cookie then simply refers to a stylesheet, which can change the whole
look and feel of the site. Very straightforward.
MerMer
James Bennett wrote:
> On 6/20/07
I have a model called REWARD, which has a one-to-one relationship with a
model called PROMOTION
I seem to be able to access the attributes of REWARD via PROMOTIONS but
I can't seem to update them.
promo=Promotion.objects.get(id=10)
promo.reward.user_visits
>> 10L
However:-
promo.reward.us
I want to change the Cache-Control on the HTTP header. Can anybody
advise how I do this. Currently my view returns
a render_to_response like so:-
return render_to_response(template_name,{'code': code
},context_instance=RequestContext(request))
Thanks
MerMer
--~--~-~--~~
I'm very occasionally getting errors reported to me on our production
site by our members. However, we cannot replicate the problem ourself
and because debugging is turned off the members are not giving me any
real clues.
Is there anyway to trap the debug information - so it is logged - but
Just what I was looking for - many thanks
MerMer
Matt McClanahan wrote:
> On Aug 13, 2:11 pm, Merric Mercer <[EMAIL PROTECTED]> wrote:
>
>
>> Is there anyway to trap the debug information - so it is logged - but
>> not visible to users?
>>
>
> A g
I have the following model:-
class Rank_Advert(models.Model):
advert = models.ForeignKey(Advert)
brand = models.ForeignKey(Brand,verbose_name="brand_owner")
rank= models.IntegerField(default=1,blank=True)
def __unicode__(self):
return self.advert
class Admin:
the PointTransaction query set.
MerMer
Benedict Verheyen wrote:
> Merric Mercer schreef:
>
>> Help! I have a function that is provided below. When I try the
>> individual lines of the function through the interpretor (Ipython)
>> everything work
Apologies, for wasting time the problem was with the line. Couldn't see
the wood for the trees!
debit = credit + i.debit
should read
debit = debit + i.debit
MerMer
Benedict Verheyen wrote:
> Merric Mercer schreef:
>
>> Benedict,
>>
>> Unfortunately, t
I may be wrong but I believe that the you cannot use the If statement
inside a template to evaluate a specific value. You use it to
determine whether the object or value exists ( has been returned by the
view).
I think that this is because the developers wanted to maintain a
distinction be
I have a template that loops through a simple query set and displays the
data in a table.
I now need to add another column to my table. However, the data in the
new column is a calculation based on two of the other fields
in that record.
I presume that this can be done using a template ta
I have view that returns a whole bunch of different variables and
boolean flags.The state of these flags determine what the user
actually sees on their screen.
From a design perspective I seem to have two options:-
1. Design a template with lots of {% if %} conditional statements to
When I want to add a new field to a database, with existing data, I
normally don't have a problem as long as I follow these steps.
1. Alter the django model.
2. Manually adjust the database table ( mySQL)
3. Run syncdb
However, I used these steps this morning and it has not worked. The new
Another observation after more investigation.
I decided to do the following:-
1. Drop the table (again) from the DB.
2. Alter the Model in Django. This time I deleted one of the original
fields named "rrp".
Then:-
1. I re-ran syncdb. This confirmed the creating of a new table in the db
2.
Can somebody provide some guidance for how to use limit_choices in a
Model. I am trying to
only display the records in the related field that contain 4.
I've tried a number of ways but keep getting a syntax error.
MerMer
promotion=models.OneToOneField(Promotion limit_choices_to={
'promo_ty
I am currently creating a query set of a Model. I'm then iterating
through the query set to create a calculation called "total".
At the end of each loop I am adding "total" to the query set. Example:-
qs= Cash.objects.all()
for i in qs:
# calculate total
i.total = total
Note: The Cash
The django book's chapter on deployment mentions the use of Database
replication as a means to scale using MySQL.
My understanding with Database replication is it uses a MASTER DB and a
number of SLAVES.
The master updates the slaves, asynchronously. This means that the
slaves are used for
tp://www.onlamp.com/pub/a/onlamp/2006/04/20/advanced-mysql-replication.html
MerMer
kemuri wrote:
> hey Merric,
>
> On Apr 9, 4:10 am, Merric Mercer <[EMAIL PROTECTED]> wrote:
>
>> The django book's chapter on deployment mentions the use of Database
>> replication
Julio,
In this scenario am I right in thinking that in MySQL the Master
automatically acts as a load balancer and that I therefore don't need
any other software
to automatically delegate reads between slaves and MySQL knows to send
all writes to the Master?
I'm slightly confused, I've been
d slaves S1 and S2
> are configured. Application asks M for row id 15. M sends query to S1.
> S1 answers to M who answers to application. Application asks for row
> id 20. M sends to the next slave, S2, and so on. As new queries keep
> coming, so M keeps rotating between its slaves.
>
Bennett wrote:
> On 4/9/07, Merric Mercer <[EMAIL PROTECTED]> wrote:
>
>> The official documentation on MySQL 5.1 "Using Replication for
>> ScaleOut" is explicit and states that it is the application (Django)
>> that needs to send the writes to the Master a
Being a relative newbie I don't really understand how to create a
fixture for the testing framework. Could someone provide an example of
the format of a
fixture ?
I tried to run the dumpdata command because I'd read that this did much
of the work for me but I received the following error mes
First Question:-
In my view if I do:-
qs=Model.objects.all()
for i in qs:
setattr( i, "firstname", firstname ) # add a new attribute
("firstname") with correponding value
import django.core serializers
data=serializers.serialize('json',data)
render_to_response(template,{'data':data,'qs
The above should read
data=serializers.serialize('json',qs)
If I do qs[0].firstname I get the value of firstname, but this doesn't seem to
be bundled in 'data'
MerMer
Merric Mercer wrote:
> First Question:-
>
> In my view if I do:-
>
> qs=Model.obje
I'm getting, what seems to me, an inconsistency.
Here's a simplified example:
>>qs=Mymodel.objects.all()
>>for i in qs:
setattr(i,"firstname","merric")
This works on:-
>>qs[0].firstname
>>merric
It also works in the temp
The line of my previous post
" print i.name" should read "print i.firstname
This is just a correction to my post, not to my problem! Thanks
MerMer
Merric Mercer wrote:
> I'm getting, what seems to me, an inconsistency.
> Here's a simplified example:
>
>
&
I'm have the following three Models.
1.Category Model
2. Promotion Model
- Has a many to many relationship with Category.
- Is the Parent of the Cash Model.
3.Cash Model
- Has one to one relationship with Promotion.
I want to create a query set of Cash Objects, filtered by a speci
I have a template that has 3 non-contiguous areas. I need to display
the results of a query set across these three areas.
My initial solution was to split up the query set in the template using
"slice". For example:
{% for object in object_list|slice:"1:6" %}area one {% endfor %}
{% for objec
Does anybody know if it is possible to set up Dreamweaver CS3 to edit
web pages, dynamically created by Django.Dreamweaver works with PHP
and various other scripting tags - anybody have any experience with it
and Django?
MerMer
--~--~-~--~~~---~--~~
You rec
I have a model "OFFER" that has has many to many relationship with a
model "TERMS".
Class OFFER:
terms=models.ManyToMany(Terms)
Assuming I have the following value for 3 records in Term
term1=2
term2=5
term3=8
I want to return ONLY those offers which have ALL three of these terms .
I've have a VIEW, which can return either a JSON file or an html template.
Does anybody know how I can use javascript, so the browser can determine
whether the response is either JSON or html text?
I presume that there is something in javascript that can determine the
content-type of the respo
I'm having a problem which is causing me real concern.
When I try to save a new record to a table, via the Admin (editing
inline), ALL of the records within that table are being deleted!
Here's a brief description of what I have:-
class A # This is a user profile table that extends USER
OneT
posts via the web are not appearing on the board,
so I tried to
email directly.
MerMer
Merric Mercer wrote:
> I'm having a problem which is causing me real concern.
>
> When I try to save a new record to a table, via the Admin (editing
> inline), ALL of the records within that t
exact model-definition?
> where is "core=True"?
>
> patrick
>
> Am 27.10.2006 um 14:15 schrieb Merric Mercer:
>
>
>> I'm having a problem which is causing me real concern.
>>
>> When I try to save a new record to a table, via the Admin (editing
>
Thanks for all your points. I'm having real problems with Google
groups. I figured out what was wrong - but was not able to post in.
Now, these posts are obviously coming in - 24 late.
MerMer
>
> Karen
>
> p.s. Is google groups acting up? I just got a bunch of old mails
> (like this one),
Many thanks Don. I figured it out, but because of issues with google
have had problems posting back.
It turns out that I don't even have to use get_profile. Something like
{{ user.userprofile.postcode }} works fine, where userprofile is the
name of the one-to-one class.
MerMer
> On Oct 26
Is it possible to pass a variable to a Customer Model Manager?
I want to pass a variable to the Customer Manager and then use this
Manager within an inclusion Tag. Example below.
class UserPoint(models.Manager):
def get_query_set(self):
return super(UserPoint,self).get_query_s
I'm am having a problem with the DateTimeField when I save the data
through the related class.
Example
class Transaction:
user =
ForeignKey(UserProfile,edit_inline=models.TABULAR,num_extra_on_change=0)
DateTimeField(auto_now_add=True, blank=True)
When I add data to Transaction, through the Ad
As a newbie to Python, I can't see how one can nest two loops within a
template. Taking the template below, I have an additional list which I
need to iterate over in order to display a single figure for the last
cell in each table row.
Currently, if I add a for loop to the last cell (eg. {%
I am thinking of using an Inclusion Tag on each of my generic views, as
a log on form, visible only to unauthenticated users.
It's very straight foward to create an inclusion tag that returns a
bland login form, but is it possible to create one that can uses the
manipulators/validators that Dj
Assuming I have a generic view. Can I used the "extra_context"
parameter to pass a request object to a function elsewhere or resolve
request.path directly?
Example of what I am trying to do is below:-
from django.http import HttpResponse, HttpRequest
from jmyapp.blog.views import test
info_
particularly as
Django seems to have many different ways to achieve a particular task.
Cheers
MerMer
James Bennett wrote:
> On 11/2/06, Merric Mercer <[EMAIL PROTECTED]> wrote:
>
>> Assuming I have a generic view. Can I used the "extra_context"
>> parameter
Starting with specific record in a child table I need to do the the
following.
1. Access a related field 'Brand Name' in the parent table. ( No problem)
2. Retrieve a query set of records in the Parent table that match the
'Brand Name'. (No Problem) BUT I want to exclude the initial reco
As part of my render_to_response I have returned the following:-
'campaigns':dict1 - where dict1 is a dictionary of objects from a model
called "Campaigns".
In my template I can do things like {{ campaigns.0.id }} and {{
campaigns.1.id }} to access the dictionary.
But, how do I iterate over
odels.campaign".
As mentioned, I can access theese values directly in the template using
the following syntax {{ campaigns.. }}. For
example, {{ campaigns.0.id }} works fine for that particular instance.
However, I can't seem to iterate through the whole dictionary.
MerMer
> {%
Jay,
Many thanks for this. As a recent newbie to Django and Python could you
give me a steer what I would need to do to make this tag. (I familiar
with making tags and filters, but can't see how I can use a tag to solve
this problem.)
MerMer
Jay Parlar wrote:
> On 11/10/06, Jay Parlar <[EMA
Jay, that works! Many thanks. Though I don't quite understand why - or
where 'values' come from. Could you explain.
MerMer
>
> {% for item in campaigns.values %}
> {{item.id}}
> {% endfor %}
>
> >
>
>
>
--~--~-~--~~~---~--~~
You received this message beca
Very helpful and instructive. Thanks.
MerMer
Jay Parlar wrote:
> On 11/10/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
>
>> On 11/10/06, Merric Mercer <[EMAIL PROTECTED]> wrote:
>>
>>> Jay, that works! Many thanks. Though I don't quite unde
I'm still a little uncertain of how to put a wrapper around a generic
view. Given the following code below how does one handle pagination and
other
work that generic views does automatically.
from django.views.generic.list_detail import object_list
def generic_wrapper(request):
qs = Ar
By using TEMPLATE_ CONTEXT_PROCESSOR (by adding a path to a function,
example - Function X) I understand that I can access the variables of
Function X in any template.
What I would like to know is does this function get run in every
template - even if I don't need it in a template.
For examp
Help! I have a function that is provided below. When I try the
individual lines of the function through the interpretor (Ipython)
everything works as expected. For example:-
>> qset=PointTransaction.objects.filter etc this works fine!!
However, when I try to run the function as a
64 matches
Mail list logo