Key Erro: 'perms' whenever I try and view a table in Admin

2009-02-10 Thread merric
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

Re: Upgrade to development version - Admin no longer works

2008-03-03 Thread merric
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 > > module.

Re: cannot set cache keys

2008-03-03 Thread merric
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

Upgrade to development version - Admin no longer works

2008-03-03 Thread merric
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

Re: cannot set cache keys

2008-03-03 Thread merric
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

cannot set cache keys

2008-03-03 Thread merric
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"

Re: Issues with IE7 and {% for %} {% endfor %} tag

2008-02-21 Thread merric
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 in

Re: Issues with IE7 and {% for %} {% endfor %} tag

2008-02-21 Thread merric
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

Issues with IE7 and {% for %} {% endfor %} tag

2008-02-21 Thread merric
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

Specifiying content-type for JSON

2007-12-16 Thread Merric Mercer
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

Re: Using a filter with many to many relationship

2007-09-17 Thread merric
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" > > > The attr

Re: Using a filter with many to many relationship

2007-09-17 Thread merric
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 can't get this to work for me. > > &g

Re: Odd behavior of filtering

2007-09-16 Thread merric
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,

Re: Using a filter with many to many relationship

2007-09-16 Thread merric
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 OFFER: > >terms=mode

Using a filter with many to many relationship

2007-09-14 Thread Merric Mercer
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 .

Unicode Type Error when adding M2M field

2007-09-05 Thread Merric Mercer
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:  

Re: Debugging production site.

2007-08-14 Thread Merric Mercer
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

Debugging production site.

2007-08-13 Thread Merric Mercer
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 -

Render_to_response and varying the headers

2007-07-01 Thread Merric Mercer
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

One-to-one - can't seem to be able to update Model

2007-06-21 Thread Merric Mercer
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:-

Re: Hypothetical: Customizable Member Pages

2007-06-21 Thread Merric Mercer
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

HttpResponseRedirect and IE6

2007-06-19 Thread Merric Mercer
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

django and Dreamweaver CS3

2007-05-22 Thread Merric Mercer
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

Pagination causing mySQL error

2007-05-04 Thread Merric Mercer
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

Many to Many - struggling with the syntax.

2007-04-18 Thread Merric Mercer
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

Re: puzzeled by possible inconsistency in queery set.

2007-04-18 Thread Merric Mercer
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: > >

puzzeled by possible inconsistency in queery set.

2007-04-18 Thread Merric Mercer
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 template:- {%

Re: json and django - couple of questions.

2007-04-17 Thread Merric Mercer
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.objects.all() > for i in q

json and django - couple of questions.

2007-04-17 Thread Merric Mercer
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)

Testing Framework and Fixtures

2007-04-11 Thread Merric Mercer
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

Re: Django scaling and Database replication

2007-04-09 Thread Merric Mercer
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

Re: Django scaling and Database replication

2007-04-09 Thread Merric Mercer
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. > > On 4/8/07, Merric Mercer

Re: Django scaling and Database replication

2007-04-09 Thread Merric Mercer
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

Re: Django scaling and Database replication

2007-04-09 Thread Merric Mercer
mp.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 as a means to scale

Django scaling and Database replication

2007-04-08 Thread Merric Mercer
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

limit_choice_to option for related Model

2007-03-27 Thread Merric Mercer
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={

Re: Changing the database - attribute errors

2007-03-20 Thread Merric Mercer
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

Changing the database - attribute errors

2007-03-20 Thread Merric Mercer
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

Designing for Speed - conditionals inside the view versus the template

2007-03-12 Thread Merric Mercer
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

Template Tags

2007-03-08 Thread Merric Mercer
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

Re: Newbie Question: If statement in templates help

2007-02-25 Thread Merric Mercer
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

Re: iteration of query set appears to fail when running function directly from interpretor

2007-02-15 Thread Merric Mercer
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, that i

Re: iteration of query set appears to fail when running function directly from interpretor

2007-02-15 Thread Merric Mercer
ransaction 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 works as expec

iteration of query set appears to fail when running function directly from interpretor

2007-02-14 Thread Merric Mercer
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

Template_context_Processor - Does it create an overhead on every template?

2007-02-12 Thread Merric Mercer
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

Re: How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Merric Mercer
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 understan

Re: How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Merric Mercer
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

Re: How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Merric Mercer
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

Re: How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Merric Mercer
s 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 > {% for item in campaigns %} > {{ item.id }} > {% endfor %} > > &g

How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Merric Mercer
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

Retreiveing a QSet from a Parent Table

2006-11-10 Thread Merric Mercer
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

Re: Can I pass a Request object within "extra_context" of a Generic View.

2006-11-02 Thread Merric Mercer
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 to pass a requ

Can I pass a Request object within "extra_context" of a Generic View.

2006-11-02 Thread Merric Mercer
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

Inclusion Tab for Log in form

2006-11-01 Thread Merric Mercer
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

DateTimeField - Value Error - 'Year is out of Range'

2006-10-30 Thread Merric Mercer
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

How does one pass a variable to a Custom Model Manager for use in an inclusion tag?

2006-10-30 Thread Merric Mercer
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

Re: Template Tag - Using Sessions versus Direct DB access - pros and cons

2006-10-27 Thread Merric Mercer
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

Re: Logout method returning "maximum recursion depth exceeded" - Help!

2006-10-27 Thread Merric Mercer
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),

Re: Major Concern - Edit Inline is Deleting ALL the records when I try to save ONE record.

2006-10-27 Thread Merric Mercer
el-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 >> inline),

Major Concern - Edit Inline is Deleting ALL the records when I try to save ONE record.

2006-10-27 Thread 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 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