get_template & nodelist problem

2009-01-15 Thread Greg
n? Thanks, Greg --~--~-~--~~~---~--~~ 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 d

Re: get_template & nodelist problem

2009-01-15 Thread Greg
from django.template.loader import get_template t = get_template("editable_pages/test.html") print t.nodelist.get_nodes_by_type(MyAppNode) Cheers, Greg --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

Re: get_template & nodelist problem

2009-01-15 Thread Greg
> Or just read the code - that's what I did FWIW !-) Tried that. In fact I'd actually tried the get_nodes_by_type method and in hindsight I realise it failed for the reason below, but I didn't realise that at the time. > > One other slightly tricky thing that I just figured out - when > >

Re: get_template & nodelist problem

2009-01-17 Thread Greg
> Nice to know - but I really wonder why it works that way (I guess I'll > have to look at this by myself). Perhaps would it be useful to > document that somewhere (djangosnippets or the wiki ?) I think so - had I known that was the problem it would have saved me a number of hours. I'm not

Posted data limits in django?

2009-03-10 Thread Greg
Cheers, Greg --~--~-~--~~~---~--~~ 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 django-user

Re: Uploading 1 image...making multiple dimensions of that image?

2007-07-25 Thread Greg
John, And how would I go about installing the 'contrib.thumbnails.7.patch'? Would I use svn? On Jul 25, 9:43 am, Patrick <[EMAIL PROTECTED]> wrote: > On Tue, 24 Jul 2007 20:21:45 -0500, John Shaffer wrote: > > You might want to look at #4115, which adds a thumbnail filter: >

Displaying the contents of a Dict (Using POST)...showing 'x' and 'y' keys?

2007-07-27 Thread Greg
I post some info to a view. When I do a 'assert False, request.POST' I see the following It should only have 8 keys (1 through 8). Instead I see the keys 'x' and 'y'? It's causing a problem when I try to loop through my POST data. Does anybody know why this is happening? Thanks

Indent Problem?

2007-07-27 Thread Greg
I have the following view: def addpad(request): if request.method == 'POST': pads = request.session.get('pad', []) i = 1 b = 1 for a in request.POST: if a != '---':

Looping through my POST data?

2007-07-27 Thread Greg
I'm trying to loop through my POST data. However I am having difficulties. I think my 'for' statement might be wrong. Below is my function and template code View function def addpad(request): if request.method == 'POST': pads =

Re: Looping through my POST data?

2007-07-27 Thread Greg
ad', []) >for pad in pads: > if request.POST[pad.id] <> '---': # the select > name should be the pad id based on your template code > # do something here ... because it wasn't > --- > > On Jul 27, 5:54 pm, Greg <[EMAIL PROTECTE

Re: Looping through my POST data?

2007-07-28 Thread Greg
rd <[EMAIL PROTECTED]> wrote: > To illustrate with the Python shell: > > >>> 0 == "0" > False > >>> 0 == int("0") > > True > > On Jul 27, 11:10 pm, Sean Perry <[EMAIL PROTECTED]> wrote: > > > On Jul 27, 2007, at 10:36

Re: Looping through my POST data?

2007-07-28 Thread Greg
Carole, So your saying that I should do: opad = RugPad.objects.all() for a in opad.id if request[a] != 0 .#add to session On Jul 28, 8:43 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Greg... I'm curious as to why you're iterating over the entire &

Re: Looping through my POST data?

2007-07-28 Thread Greg
o value selected, > instead of iterating all of the request.POST keys. This way you can > have other items in your form if needed. > > On Jul 28, 10:58 am, Greg <[EMAIL PROTECTED]> wrote: > > > Carole, > > So your saying that I should do: > > > opad =

Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-29 Thread Greg
Ok, I just added a Field in my Orders class. It looks like this: timestamp = models.DateField("Creation Date") // I create a new instance of the order class below: o = Orders() o.s_name = 'Greg Smith' o.s_address = '123

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-29 Thread Greg
... o.timestamp = datetime.now() When I drill down on the order from within my admin I still get the error listed above. Thanks On Jul 29, 7:45 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > Ok, >

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-29 Thread Greg
ield("Has an email been sent") order = models.TextField("Details of Order", maxlength=1000) comments = models.TextField("none", maxlength=1000) class Admin: list_display = ('s_name', 'order_status') def __str__(self,): return self.s_name On Jul

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-29 Thread Greg
('result.html', {'s': odet, 'r': c, 'spad': p, 'p': pr}) else: return render_to_response('result.html', {'s': 'Did not work'}) On Jul 30, 12:00 am, Greg <[EMAIL PROTECTED]> wrote: > Russ, > Here is my Orders Class: > > class Orders(models.Model

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-29 Thread Greg
Russ, Here is what I get with I use 'python manage.py shell' >>> b = Orders.objects.get(pk=1) >>> b.s_name u'Bob Smith'' >>> b.timestamp u'2007-07-29' >>> No errors when I access the timestamp property from within the python shell. On Jul 30, 12:00 am, Gr

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-30 Thread Greg
Russell, I'm using sqlite DATABASE_ENGINE = 'sqlite3' I can't seem to find out what django revision I have. I ran 'svn info' from c:/django however it said 'svn: '.' is not a working copy' On Jul 30, 6:49 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-30 Thread Greg
ion: 5709 Node Kind: directory Schedule: normal Last Changed Author: mtredinnick Last Changed Rev: 5708 Last Changed Date: 2007-07-15 05:10:44 -0500 (Sun, 15 Jul 2007) Thanks On Jul 30, 8:43 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/30/07, Greg <

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-30 Thread Greg
Russ, I guess I have v3. In my settings.py file i have: DATABASE_ENGINE = 'sqlite3' On Jul 30, 6:57 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/31/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > Russ, > > I'm using SQLite version -

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-30 Thread Greg
Russ, pysqlite2.3.3 On Jul 30, 7:20 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/31/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > I guess I have v3. In my settings.py file i have: > > > DATABASE_ENGINE = 'sqlite3' > > That'

I get an error when my query returns nothing

2007-07-31 Thread Greg
Hello, I have the following if statement in one of my views: if (Style.objects.get(id=a.id).sandp.get(price=request['price'])==True): // Sometimes, the query will not find any results. However, when this line gets accessed I get the following error: Choice matching query does not

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-31 Thread Greg
ECTED]> wrote: > On 7/31/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > pysqlite2.3.3 > > That's just the binding. What version of SQLite itself? > > Russ %-) --~--~-~--~~~---~--~~ You received this message because you are s

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-31 Thread Greg
bump On Jul 31, 2:53 pm, Greg <[EMAIL PROTECTED]> wrote: > Russ, > Ha...sorry I'm such a idiot. > > I think I got in now (If not...you might need to help me find it). > > My Zip file that I downloaded is labeled sqlite-3_3_15. Is that what > you need? > >

Can a ManyToManyField only shows certain records in an admin using edit_inline?

2007-07-31 Thread Greg
Ok, Here is my model file: class Collection(models.Model): name = models.CharField(maxlength=200) collectionslug = models.SlugField(prepopulate_from=["name"]) description = models.TextField(maxlength=1000) manufacturer = models.ForeignKey(Manufacturer) class

Re: Can a ManyToManyField only shows certain records in an admin using edit_inline?

2007-08-01 Thread Greg
We'll I kinda got it to work. I added the following (limit_choice_to): sandp = models.ManyToManyField(Choice, limit_choices_to = {'choice': 2}) /// That works fine. However, I obviously want to take out the '2'. I tried the following but it does not seem to work: sandp =

Re: Can a ManyToManyField only shows certain records in an admin using edit_inline?

2007-08-01 Thread Greg
) return g Thanks On Aug 1, 11:09 am, Greg <[EMAIL PROTECTED]> wrote: > We'll I kinda got it to work. I added the following > (limit_choice_to): > sandp = models.ManyToManyField(Choice, limit_choices_to = {'choice': > 2}) > > /// > > That works fi

Re: Can a ManyToManyField only shows certain records in an admin using edit_inline?

2007-08-01 Thread Greg
Anybody? On Aug 1, 2:49 pm, Greg <[EMAIL PROTECTED]> wrote: > Ok..does anybody know what's wrong with this attempt at trying to get > the 'limit-choices_to' to work? > > class Choice(models.Model): > choice = models.ForeignKey(Collection, edit_inline=models.TABU

Re: How to Display error messages when is form is not valid?

2007-08-01 Thread Greg
you want to display if an error happens{% endif %} On Aug 1, 8:42 pm, Greg <[EMAIL PROTECTED]> wrote: > I've seen examples from other websites where when a form is submitted > and some of the required fields contain no data. It takes them back > to the same url and display

How to Display error messages when is form is not valid?

2007-08-01 Thread Greg
I've seen examples from other websites where when a form is submitted and some of the required fields contain no data. It takes them back to the same url and displays messages like '*** This field is required' above the form field. I currently have my form setup so that when it's submitted and

Do I have to send shopping cart data to every template in my app?

2007-08-01 Thread Greg
I've created a shopping cart. I want to put something on the top of every page that let's people know how many items they have in their cart. I have a lot of views that don't send any dictionary key's that contain shopping cart info. If I want to do this...do I now have to edit every view

Using limit_choices_to on a ManyToMany Field

2007-08-02 Thread Greg
I've looked everywhere for information on how to use the 'limit_choices_to' attribute...but can't seem to find the answer. I have the following models: class Choice(models.Model): choice = models.ForeignKey(Collection, edit_inline=models.TABULAR, num_in_admin=5) size =

Re: Using limit_choices_to on a ManyToMany Field

2007-08-02 Thread Greg
(models.Model): name = models.CharField(maxlength=200) collectionslug = models.SlugField(prepopulate_from=["name"]) description = models.TextField(maxlength=1000) manufacturer = models.ForeignKey(Manufacturer) Thanks for your help On Aug 2, 1:23 pm, Greg <[EMAIL PROT

Re: Do I have to send shopping cart data to every template in my app?

2007-08-03 Thread Greg
Thanks for your help...I'm now able to create a custom tag. However, I now seem to have a another problem with custom tags. How do I send session information to each template. I can't use request.session['cart'] in my custom tag function because it doesn't have a request parameter. I always

Re: Can a ManyToManyField only shows certain records in an admin using edit_inline?

2007-08-05 Thread Greg
nufacturer) def __str__(self,): return self.name class Admin: list_display = ('name', 'manufacturer') list_filter = ('manufacturer',) / Thanks for any help. On Aug 2, 4:57 am, yml <[EMAIL PROTECTED]> wrote: > Greg, > I am waiting for the a

Using order_by with a field from a different table

2007-08-05 Thread Greg
I'm running through some djagno API examples and I'm having a problem with how to order by a field in a different table. Here is what my models: class Blog(models.Model): name = models.CharField(maxlength=100) tagline = models.TextField() def __unicode__(self): return

Re: Do I have to send shopping cart data to every template in my app?

2007-08-06 Thread Greg
<[EMAIL PROTECTED]> wrote: > If you really need to use a tag, look > athttp://www.djangoproject.com/documentation/templates_python/#passing-... > But I think you probably would find it easier to add an extra context > processor & avoid the tag altogether. > > -rob > &g

Using filter(...) to bring back all records?

2007-08-06 Thread Greg
Hello, I have a form that will contain 3 select input types. The user is going to have the ability to narrow down the products by selecting a value in these 3 select boxes (Price, Size, Color). However, the user also has the ability to not select anything. In this case I would want to return

Using **?

2007-08-07 Thread Greg
Can somebody please help me understand what ** does? I have the following code: >>> mydict = {} >>> if 1 != "---": ... mydict['id'] = 2 ... >>> b = Blog.objects.filter(mydict) >>> b This prints out an error 'AttributeError: 'dict' object has no attribute 'get_sql'' / However,

Using Filter on a list of objects?

2007-08-07 Thread Greg
I am trying to develop some functionality so that a user is able to query by a color. I have a form drop-down menu where the user can select one color type to appear. They are also able to leave it blank so that it returns all the available colors. I have my form returning the right results

Re: Using Filter on a list of objects?

2007-08-07 Thread Greg
Tim, I added your code into my view. However, it seems to error out on me when I get to the line 'if 'color' in request and request['color'] <> NO_COLOR: '. The error says: KeyError at /rugs/searchresult/ '0 not found in either POST or GET' // Here is my view def

Re: Using Filter on a list of objects?

2007-08-08 Thread Greg
if num == 0: dict[p] = p#assert False, styles return render_to_response('searchresult.html', {'s': dict}) / Please let me know on a scale of 1-10 on how (good/bad) this code is. Thanks On Aug 8, 6:43 am, Nis Jørgensen <[EMAIL PROTE

Re: Using Filter on a list of objects?

2007-08-08 Thread Greg
Tim, Thanks for the reply. Very helpful. In the past I did try the statement: if 'price' in request and request['price'] <> NOT_PICKED: However when that line was accessed I would get the following error: KeyError at /rugs/searchresult/ '0 not found in either POST or GET'

Re: Using Filter on a list of objects?

2007-08-08 Thread Greg
Tim, Why do I need to do the following: if ('price' in request.POST) and (request.POST['price'] <> NOT_PICKED): instead of if request.POST['price'] <> NOT_PICKED: Everytime the form is submitted a value for price is sent to the view. If no price was selected then the value of

Re: Using Filter on a list of objects?

2007-08-08 Thread Greg
Tim, I think you just got my color search to work (Thank You). Here is the code: NO_COLOR = "---" styles = Choice.objects.get(id=h.id).style_set.all() if ('color' in request.POST) and (request.POST['color'] <> NO_COLOR): styles = styles.filter(color_cat=request['color']) for u

filter a list of objects?

2007-08-08 Thread Greg
I have a list of objects and I want to be able to do a filter on a list of objects. Here is my code: y = Choice.objects.all() assert False, y #output of this statement is below AssertionError at /rugs/searchresult/ [, )>, , )>, , )>, , )>, , )>, , )>, , )>, , )>, , )>, , )>] / We'll I

Re: Using Filter on a list of objects?

2007-08-09 Thread Greg
Tim and Nis, Okay thanks for the help. My view is definitily better now than before. Here is my new view def searchresult(request): if request.method == 'POST': myset = set() NOT_PICKED = "---" y = Choice.objects.all()

Re: Using Filter on a list of objects?

2007-08-09 Thread Greg
2, 3, 4, 5, 9]) >>> s2.add(5) >>> s2 set([1, 2, 3, 4, 5, 9]) I created the same thing using the s2 variable and the s2.add(5) statement wasn't added to the list. It makes me wonder if the two '' and ' objects are different, because based on my example only one of each should be in th

Re: Using Filter on a list of objects?

2007-08-09 Thread Greg
RajeshD, I implemented what you said. Here is my attempt: choice_ids = [c.id for c in y] styles = Style.objects.filter(sandp__choice__in=choice_ids) if ('color' in request.POST) and (request.POST['color'] <> NOT_PICKED): styles = styles.filter(color_cat=request['color'])

Re: Using Filter on a list of objects?

2007-08-09 Thread Greg
= models.ForeignKey(Collection, edit_inline=models.TABULAR, num_in_admin=6) sandp = models.ManyToManyField(Choice) // Thanks again for the help On Aug 9, 5:52 pm, RajeshD <[EMAIL PROTECTED]> wrote: > Hi Greg, > > > myset.add(styles) > > You don'

Re: Using Filter on a list of objects?

2007-08-10 Thread Greg
'color'] <> NOT_PICKED): styles = styles.filter(color_cat=request['color']) return render_to_response('searchresult.html', {'s': styles}) / Hopefully, it's at least readable now. Thanks again to everybody that helped! On Aug 10, 8:48 am, RajeshD <[EMA

Re: Thumbnail - django-utils - Google Code

2007-08-10 Thread Greg
Lisa, Very Interesting. How would I go about getting the module 'nesh.thumbnail.field'? Do I need to get the latest revision of django? Thanks On Aug 10, 5:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hey all, > > I'm new to the group, but I thought you guys might find this little

Re: Thumbnail - django-utils - Google Code

2007-08-10 Thread Greg
ror found. // Anybody have any suggestions? Thanks On Aug 10, 11:23 pm, Greg <[EMAIL PROTECTED]> wrote: > Lisa, > Very Interesting. How would I go about getting the module > 'nesh.thumbnail.field'? Do I need to get the latest revision of > django? > > Thanks >

Using Nesh Thumbnail - Not displaying correct dimensions

2007-08-15 Thread Greg
Hello, I've installed the nesh library. I've added a field in my models with type ImageWithThumbnailField. Here is my template code to display the image When I view this page in the browser it displays the image with the original dimensions. When I do a View -> Source in the browser this is

Re: Using Nesh Thumbnail - Not displaying correct dimensions

2007-08-15 Thread Greg
The file I uploaded was called 'IMG_0090'. When I looked in the site- media folder it has been renamed to 'myphototest-photo-none' Thanks On Aug 15, 9:18 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 16-Aug-07, at 7:37 AM, Greg wrote: > > > is all I see - . > >

Re: Using Nesh Thumbnail - Not displaying correct dimensions

2007-08-16 Thread Greg
none supposed to be the object pk. Shouldn't that be a 1,2,3 etc instead of none? Thanks On Aug 16, 12:06 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 16-Aug-07, at 8:05 AM, Greg wrote: > > > The file I uploaded was called 'IMG_0090'. When I looked in the site- >

Re: Using Nesh Thumbnail - Not displaying correct dimensions

2007-08-16 Thread Greg
Kenneth, Thanks for the reply. When you use nesh and you upload a picture is the name of the picture: classname-fieldname-none.jpg? Or does the filename contain the pk of the record? Thanks On Aug 16, 7:42 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 16-Aug-07, at 9:02

Re: Using Nesh Thumbnail - Not displaying correct dimensions

2007-08-16 Thread Greg
it have smaller dimensions? Thanks On Aug 16, 8:33 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 17-Aug-07, at 6:49 AM, Greg wrote: > > > Thanks for the reply. When you use nesh and you upload a picture is > > the name of the picture: > > > classname-fieldnam

Float Field not displaying the two zeros at the end of a price

2007-08-19 Thread Greg
I have a FloatField called price that stores the price of different elements. When the price is 19.99, 19.79, 19.01 etc... everything is displayed correctly. However, when I have a price of 19.00. The price when viewed in a browser is just 19. Is there anyway that I can have it display the

Re: Float Field not displaying the two zeros at the end of a price

2007-08-19 Thread Greg
{{ price|floatformat:2 }} > > On Aug 19, 4:44 pm, Greg <[EMAIL PROTECTED]> wrote: > > > I have a FloatField called price that stores the price of different > > elements. When the price is 19.99, 19.79, 19.01 etc... everything is > > displayed correctly. However, wh

Re: Float Field not displaying the two zeros at the end of a price

2007-08-19 Thread Greg
' on. name = models.FloatField() Thanks Line 26 is what is highlighted red. Thanks On Aug 19, 11:36 pm, jake <[EMAIL PROTECTED]> wrote: > hi greg, > > just checking - did you try both at once? ie DecimalField in your model > and |floatformat:2 in your template. > > -jake >

Re: Float Field not displaying the two zeros at the end of a price

2007-08-20 Thread Greg
wrote: > greg, > > Greg wrote: > > Jake, > > No I didn't. When I tried the 'floatformat:2' I made sure that my > > model fields were of type FloatField. > > i have used DecimalField in my model and |floatformat:2 in my template > and gotten the behavior you're look

Re: Float Field not displaying the two zeros at the end of a price

2007-08-20 Thread Greg
template I changed it to a.price.name and it works. The two zeros now appear. Thanks for your help On Aug 20, 2:14 pm, jake <[EMAIL PROTECTED]> wrote: > hi greg, > > Greg wrote: > > Jake, > > I've made the change to where both of my fields are now of type > > De

Error when creating thumbnails based on a class that is edit_inline

2007-08-23 Thread Greg
Hello, I'm having a problem when I try to create thumbnails for a class that is has edit_inline. Here are my two models: class Collection(models.Model): name = models.CharField(maxlength=200) collectionslug = models.SlugField(prepopulate_from=["name"]) photo =

Re: Error when creating thumbnails based on a class that is edit_inline

2007-08-27 Thread Greg
within my Photo save method doesn't work? Above is my code Thanks Greg wrote: > Hello, > I'm having a problem when I try to create thumbnails for a class that > is has edit_inline. Here are my two models: > > class Collection(models.Model): > name = models.CharF

Error adding DateField - 'unicode' object has no attribute 'strftime'

2007-08-28 Thread Greg
Hello, I have the following code in my models.py file class Orders(models.Model): timestamp = models.DateField() ... etc / I have the following in my view.py function from datetime import datetime o = Orders() o.timestamp = datetime.now() ... etc o.save()

Re: Error adding DateField - 'unicode' object has no attribute 'strftime'

2007-09-05 Thread Greg
Michael, I'm using sqlite. Lapin, Where in my code do you want me to use smart_str? Thanks On Aug 29, 3:58 am, Michael Radziej <[EMAIL PROTECTED]> wrote: > On Tue, Aug 28, Greg wrote: > > > Hello, > > I have the following code in my models.py file > &g

Re: Error when creating thumbnails based on a class that is edit_inline

2007-09-05 Thread Greg
rt('RGB') firsti.thumbnail(THUMBNAIL_SIZE, Image.ANTIALIAS) secondi.thumbnail(THUMBNAIL_SIZE2, Image.ANTIALIAS) firsti.save(self.get_simage_filename()) secondi.save(self.get_mimage_filename()) super(Style, self).save() Thanks for any hel

Signals not working correctly

2007-09-13 Thread Greg
Hello, I'm trying to use signals so that when a Publication gets deleted from within the Admin it will 'assert False, "Here"' (This will obviously change at a later date). Currently, when I delete a Publication (in the django admin) no assert statement is raised. So I guess that means that my

Signals not working correctly

2007-09-13 Thread Greg
Hello, I'm trying to use signals so that when a Publication gets deleted from within the Admin it will 'assert False, "Here"' (This will obviously change at a later date). Currently, when I delete a Publication (in the django admin) no assert statement is raised. So I guess that means that my

Trying to use order_by on a list object

2007-09-18 Thread Greg
Hello, I have the following code 's2 = s.sandp.all()' When I do a 'assert False, s2' I get the following: [, )>, , )>, , )>, , )>] I want to be able to sort the list by the Price. /// I tried the following code s2 = s.sandp.order_by('price') assert False, s2 And this is what I get:

Re: Trying to use order_by on a list object

2007-09-19 Thread Greg
. Does anybody know what I need to change to get it so that Django compares prices instead of strings in my price field? Thanks On Sep 19, 12:04 am, Greg <[EMAIL PROTECTED]> wrote: > Hello, > I have the following code 's2 = s.sandp.all()' When I do a 'assert > False, s2' I ge

Re: Trying to use order_by on a list object

2007-09-19 Thread Greg
Tim, Here is my Price class class Price(models.Model): name = models.DecimalField(max_digits=6, decimal_places=2) price_cat = models.ForeignKey(PriceCategory) def __str__(self,): return str(self.name) class Admin: pass // I guess my 'return

def __str__(self,):

2007-09-20 Thread Greg
Do this method have to return a string? I have the following model: class Price(models.Model): name = models.DecimalField(max_digits=6, decimal_places=2) price_cat = models.ForeignKey(PriceCategory) def __str__(self,): return self.name class Admin: pass

How to call a .htm page without going to the views.py file?

2007-09-21 Thread Greg
Ok, Very easy question here. Is there anyway that I can directly call my .htm file from within my urls.py file? Now, I have the following: (r'^customer_care/$', 'mysite.rugs.views.customer_care'), def customer_care(request): return render_to_response('customer_care.html', {})

Is there a {% if_less_than %} template tag

2007-10-01 Thread Greg
Hello, I was just looking a the django built-in template tags and can't seem to find a tag that can compare two variables. I found a {% ifequal %} tag. Does one exist? Or will I have to do this logic in my view and pass my template a flag? Thanks

Create and send post data to a view?

2007-10-01 Thread Greg
I was wondering if I could send POST data to another view for processing. My original view would not be sent any POST data. The post data would get generated in my view and sent to another view for processing. Is this possible? --~--~-~--~~~---~--~~ You

How to keep track of iterations through a for loop in my template?

2007-10-01 Thread Greg
Hello, I have a table in my template that will contain an x number of rows depanding on what I get back from the view. I want my table row background color to rotate between red and white. As of now, I don't know how to keep track of each iteration through my for loop to set the appropriate

Error message when viewing admin? (ViewDoesNotExist at /admin/)

2007-10-03 Thread Greg
Hello, Whenever I login to my admin view the very first thing I see if the following error. It also happens occasionally when I'm going through my admin pages. ViewDoesNotExist at /admin/ Tried startsess in module mysite.rugs.views. Error was: 'module' object has no attribute 'startsess'

Using edit_inline DateField is not showing up

2007-10-04 Thread Greg
Hello, I have a table called Orders. Which stores information about each order that I get. It also has the ability to send email's to the customer's email address. I also have another table called EmailSent that store information about each email that I send through the admin. My EmailSent

Getting the Error 'TypeError, float argument required'

2007-10-05 Thread Greg
Hello, I have the following field in my class amount = models.DecimalField("Order Amount", max_digits=6, decimal_places=2) Whenever, I add a new record to this class I get the following error: TypeError at /admin/plush/orders/ float argument required Any suggestions? Thanks

How to set a global variable?

2007-10-09 Thread Greg
Hello, I want to create a list that can be updated from within a part of a view and retreived from another part of a view. Here is my view.py file from django.shortcuts import render_to_response, get_object_or_404 mysearchlist = [] def searchresult(request): if request.method == 'POST':

Re: How to set a global variable?

2007-10-09 Thread Greg
<[EMAIL PROTECTED]> wrote: > On 10-Oct-07, at 8:27 AM, Greg wrote: > > > def searchresult(request): > > mysearchlist = [] > > > if request.method == 'POST': > > mysearchlist = [1,2,3,4,5] > > if request.method == 'GET': > >

How to delete a table?

2007-10-10 Thread Greg
Hello, Simple question, I have a database table called Orders. I want to delete this table so that when I do 'python manage.py syncdb' the table will get recreated. I want to make some modifications to the columns in the table and I can't seem to do the with SQLite. I don't want to delete the

How to allow a ForeignKey field to be null

2007-10-10 Thread Greg
Hello, I have the following field in my Orders class delivery_method = models.ForeignKey(Delivery) I want to be able to add a Order record and not specify a Delivery option when the order is initially created. I've tried delivery_method = models.ForeignKey(Delivery, null=True) and

Re: How to allow a ForeignKey field to be null

2007-10-11 Thread Greg
y help On Oct 11, 12:41 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > On 10/11/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > > > Hello, > > I have the following field in my Orders class > > > delivery_method = models.ForeignKey(

Signals error - I can't do a import

2007-10-11 Thread Greg
Hello, I have a very strange error. When a Style gets deleted I want my signal to get called and the signal function will delete the appropriate photo. I created a new file called sig.py which just contains my 'thesignal' function. The problem arises when I do 'from mysite.plush.models import

How to delete an image off the file system?

2007-10-11 Thread Greg
Hello, I have a function 'thesignal' that deletes the Photo record from a db table. However, after that is done the photo's still appear on the file system. How do i delete these photos? Here is what I have so far: /// models.py class Photo(models.Model): photo =

How to only show records that are less than 20 days old?

2007-10-11 Thread Greg
Hello, I have a model called Style that contains a DateField. It stores the date when the record was created. I want my template to only show Style records that were created less than 20 days ago. I think that this needs to be done within the view, but not sure if there is a filter that I can

Re: How to only show records that are less than 20 days old?

2007-10-12 Thread Greg
' /// Thanks for any help On Oct 11, 10:56 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 10/11/07, Greg <[EMAIL PROTECTED]> wrote: > > > I have a model called Style that contains a DateField. It stores the > > date when the record was created. I

Getting error: 'unicode' object has no attribute 'strftime'

2007-10-12 Thread Greg
Hello, I just added the following field to my Style class: newrugs = models.DateField(auto_now_add=True) Now, when I try to view my Style objects in the admin I get the following error: AttributeError at /admin/plush/style/5/ 'unicode' object has no attribute 'strftime'

Re: Getting error: 'unicode' object has no attribute 'strftime'

2007-10-13 Thread Greg
r a reason? Will this changed have an effect on how other areas of my application work? Thanks On Oct 12, 5:34 pm, Greg <[EMAIL PROTECTED]> wrote: > Hello, > I just added the following field to my Style class: > > newrugs = models.DateField(auto_now_add=True) > > Now, w

How to add a onclick attribute to a newforms element

2007-10-13 Thread Greg
I have the following form field: s_check = forms.CharField(widget=forms.CheckboxInput) I want to add a onclick attribute to this form field in the template. How is that done in Django? This is how I show the form element in my template: {{ fo.s_check }} Thanks for any help

Re: How to add a onclick attribute to a newforms element

2007-10-13 Thread Greg
Nevermind, Got it figured out s_check = forms.CharField(widget=forms.CheckboxInput(attrs={'onclick':'showship()'})) On Oct 13, 6:26 pm, Greg <[EMAIL PROTECTED]> wrote: > I have the following form field: > > s_check = forms.CharField(widget=forms.CheckboxInput) > > I

Should I create a session variable for this?

2007-10-14 Thread Greg
Hello, I have a submission form. When the form gets submitted I need to check to see if the b_state form variable is set to 'KS'. If so, then I need to let the user know that a sales tax will be applied to their order. If they agree with the price increase then they can select 'Submit' again

Re: Should I create a session variable for this?

2007-10-14 Thread Greg
Malcolm, Can you please show me how I would use hidden fields to let me know that the user has seen the updated price? Thanks On Oct 14, 5:48 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sun, 2007-10-14 at 15:18 -0700, Greg wrote: > > Hello, > > I have a s

Re: Should I create a session variable for this?

2007-10-14 Thread Greg
'], ... 'b_city': request['b_city'] etc} f = ContactForm(data) return render_to_response('checkout_form.htm', {'fo': f}) Thanks On Oct 14, 7:56 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sun, 2007-10-14 at 17:35 -0700, Greg wrote: > > Malcolm, > > I'

How to find out if a string is contained within another string

2007-10-14 Thread Greg
Hello, I'm wanting to select a record from my Discounter class that contains a certain string from another string. My Discounter class looks like this: class Discounter(models.Model): code = models.CharField(maxlength=100) In my view I get a variable called 'message'. I want to search

Re: Should I create a session variable for this?

2007-10-14 Thread Greg
) return render_to_response('checkout_form.htm', {'fo': f, 'o': request.session['cart'], 'p': a, 'isitks': True}) Thanks for the help! On Oct 14, 9:02 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sun, 2007-10-14 at 18:32 -0700, Greg wrote: > > Malcolm,

  1   2   3   4   5   >