Re: GROUP BY and ORDER BY using the ORM

2010-07-05 Thread MikeHowarth
gt; be able to achieve something like this with F (if you want to filter > on being older than a certain number of days). > > Euan > > On Jul 5, 10:05 am, MikeHowarth <mikehowar...@googlemail.com> wrote: > > > You're right I sniped the date_time field when pa

Re: GROUP BY and ORDER BY using the ORM

2010-07-05 Thread MikeHowarth
t; > One thing I've found handy for debugging Django's ORM to SQL is > something which I don't think is documented in django docs at all > (although I maybe wrong about that) is doing: > > print qs.query > > Where qs is your queryset. It will output the SQL Django sends to the >

GROUP BY and ORDER BY using the ORM

2010-07-03 Thread MikeHowarth
Hi all Just coming back to Django after a long time away, and struggling to get my head around what should be a trivial concept using the ORM. Essentially I want to do acheive the following SQL: SELECT * FROM publisher_history INNER JOIN publisher_publisher ON publisher_publisher.id =

Re: Filtering ManyToManyField

2008-09-11 Thread MikeHowarth
Anyone? I'm really struggling with this. As stated in my first post running the code creates a recursive loop. Had a bit of a hack around with things, but can't figure anything obvious out. On Sep 11, 10:58 am, MikeHowarth <[EMAIL PROTECTED]> wrote: > The model I'm using is ver

Re: Filtering ManyToManyField

2008-09-11 Thread MikeHowarth
related_items = models.ManyToManyField('self', blank=True, null=True, verbose_name=_('Related Items'), related_name='related_products') David Reynolds wrote: > On 11 Sep 2008, at 10:06 am, MikeHowarth wrote: > > > Could anyone clarify what I need to do be doing to acheive the desired > > fi

Filtering ManyToManyField

2008-09-11 Thread MikeHowarth
I was wondering if anyone could help me. I currently have a Product model which has a many to many association linked back to itself for related items. When returning the related items, I want to filter out any which are not currently flagged as active. Initially I thought about doing

Re: Standalone script + get_absolute_url with urlresolvers

2008-07-14 Thread MikeHowarth
Think I may have found the issue. My .pth file was pointing to an old directory which didn't have the relevant module. For anyone wondering, its permissable not to have a views.py providing you have the __init__.py and models.py On Jul 14, 10:28 pm, MikeHowarth <[EMAIL PROTECTED]>

Re: Standalone script + get_absolute_url with urlresolvers

2008-07-14 Thread MikeHowarth
Yeah. I did think that. As far as I'm aware there aren't any errors in any of the views, however the views.py file for scripts it is an empty file. I'm guessing this is the problem in itself. Is it syntactically correct to have a views.py which is empty but exists? I'm not really sure of the

Standalone script + get_absolute_url with urlresolvers

2008-07-14 Thread MikeHowarth
I was wondering whether anyone can help me with a problem I'm having. I'm running a standalone script outside of the web server to do some maintainence tasks. In particular I need to return the absolute url from one of my models, however when I call the get_absolute_url() method, I'm getting a

Re: MS SQLServer syncdb problem

2007-11-02 Thread MikeHowarth
As far as I'm aware SQL Server isn't supported, there was a project going a while ago but I think it has lost momentum. On Nov 2, 11:36 am, lopes <[EMAIL PROTECTED]> wrote: > Hi, > I'm trying to make a syncdb and I've got the following message on > creating "auth_user" table, i've already

Re: form_for_instance + user profile

2007-09-13 Thread MikeHowarth
, MikeHowarth <[EMAIL PROTECTED]> wrote: > Yep all working now! > > On Sep 12, 8:11 pm, RajeshD <[EMAIL PROTECTED]> wrote: > > > > Basic example: > > > > user = User.objects.get(id=1) > > > user_profile = user.get_profile() > > > This should wor

Re: Populating a form

2007-09-13 Thread MikeHowarth
Look at form_for_instance in newforms: http://www.djangoproject.com/documentation/newforms/ On Sep 13, 9:08 am, "Peter Melvyn" <[EMAIL PROTECTED]> wrote: > On 9/11/07, Ole Laursen <[EMAIL PROTECTED]> wrote: > > > You can also use the initial parameter when instantiating the form: > > And how

Re: form_for_instance + user profile

2007-09-12 Thread MikeHowarth
Yep all working now! On Sep 12, 8:11 pm, RajeshD <[EMAIL PROTECTED]> wrote: > > Basic example: > > > user = User.objects.get(id=1) > > user_profile = user.get_profile() > > This should work if you have settings.AUTH_PROFILE_MODULE pointing to > your UserProfile model. >

Re: Master Page Code

2007-09-12 Thread MikeHowarth
Have a look at template inheritance http://www.djangoproject.com/documentation/templates/#template-inheritance This may give you more of any idea of how to structure your main template. [EMAIL PROTECTED] wrote: > I'm a web developer and I'm developing my first application using > Django. I'm

form_for_instance + user profile

2007-09-12 Thread MikeHowarth
I've had a read through the docs and have created a UserProfile object with a ForeignKey to Djangos User object. What I want to be able to do is load the UserProfile so this can then be edits. I tried this last night (admittedly not very hard) and didn't seem to have any joy. Basic example:

Re: Temporary access to link in django

2007-09-12 Thread MikeHowarth
I think you may be complicating things unnecesarily by not creating a user. Why not look at creating a temporary user group, and maybe adding an additional check at login if this user is a temporary user, they cannot login 1 month after the date created of the user? On Sep 12, 7:50 am, Przemek

Re: Login issues

2007-09-11 Thread MikeHowarth
Russ Thanks for the reply Russ, I totally missed this. I did wonder whether this was because I was using the email-auth backend. I'll implement your suggestion and see what happens. On Sep 11, 1:50 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 9/10/07,

Re: first naive question for a new fresh Django user

2007-09-11 Thread MikeHowarth
: > > > > > Hi, > > > I would to do the same than this example: > > >http://www.hackorama.com/ajax/ > > > Vince > > > MikeHowarth a écrit : > > >> I'm not entirely sure I follow your request. > > >> However using Ajax in Djang

Re: first naive question for a new fresh Django user

2007-09-11 Thread MikeHowarth
I'm not entirely sure I follow your request. However using Ajax in Django is a fairly simple affair:http://www.b- list.org/weblog/2006/jul/02/django-and-ajax/ On Sep 11, 3:11 pm, garonne <[EMAIL PROTECTED]> wrote: > Hello, > > I 've started playing with Django which seems very well for what i

Re: Populating a form

2007-09-11 Thread MikeHowarth
You'll need to load an instance of the model, which will pre-populate the data: http://www.djangoproject.com/documentation/newforms/#form-for-instance On Sep 11, 7:15 am, AniNair <[EMAIL PROTECTED]> wrote: > Hi... >I am trying to learn python and django. Can someone please tell me > how to

Re: Email as username in django auth framework

2007-09-10 Thread MikeHowarth
I'm using this snippet which works fine. In order to get this working, I generate a random string as the username on creation and created a unique index on the email address field. I guess it goes a little against the grain given you're patching the db however I feel email address fields should

Re: Login issues

2007-09-10 Thread MikeHowarth
Anyone? On Sep 9, 5:47 pm, MikeHowarth <[EMAIL PROTECTED]> wrote: > Hi guys > > Was wondering if anyone knew of any bugs within the user > authentication system associated to setting the backend attribute? > > Basically looking at the traceback the user object expect

Re: entering sane dates in admin

2007-09-10 Thread MikeHowarth
Sure have a look at the DATE_FORMAT within settings. I think that should do what you're after. On Sep 8, 8:29 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > hi, > is there any quick way of entering sane dates in admin - that is d/m/ > y and not y/m/d? > -- > > regards >

Re: Newbie (Before I get started)

2007-09-10 Thread MikeHowarth
I've been working in Django for all of about 4 weeks and I'm absolutely loving it. Within that time I've written my first project, something which I probably would never have acheived in another language (I'd still be stuck reading the book!) To give you a little on my background, I've

Login issues

2007-09-09 Thread MikeHowarth
Hi guys Was wondering if anyone knew of any bugs within the user authentication system associated to setting the backend attribute? Basically looking at the traceback the user object expects a attribute 'backend' to be set within however this doesn not seem to be set. Traceback: Traceback

Re: Hierarchical menus

2007-09-06 Thread MikeHowarth
Chris Thanks for the plug! Reading through that code makes it much clearer and gives me a great example to follow. I've been thinking about looking at satchmo you could just have another convert! cheers Mike On Sep 5, 9:21 pm, "Chris Moffitt" <[EMAIL PROTECTED]> wrote: > I've used satchmo

Hierarchical menus

2007-09-05 Thread MikeHowarth
I was wondering whether anyone can help me, I'm absolutely stumped where to start creating a hierarchical menu in Django. I've scoured Google and don't seem to be able to find anything to get me started. Basically I'm looking to create a simple list based menu like so: > Home > Category 1 >

Re: localflavor - UKPostcodeField

2007-08-21 Thread MikeHowarth
Thats a very valid point Malcolm and something I'll implement! On Aug 21, 12:22 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2007-08-21 at 02:20 -0700, MikeHowarth wrote: > > So really I'd be better off using: > > > from django.contrib.loc

Re: localflavor - UKPostcodeField

2007-08-21 Thread MikeHowarth
So really I'd be better off using: from django.contrib.localflavor.uk import forms On Aug 21, 9:35 am, Collin Grady <[EMAIL PROTECTED]> wrote: > The same question applies though :) > > You didn't import the "forms" bit, you imported the field directly, so > you should just be using it as

Re: localflavor - UKPostcodeField

2007-08-21 Thread MikeHowarth
Sorry that was a typo on my part Colin Should have read: forms.UKPostcodeField() Think its time for a coffee! On Aug 21, 9:19 am, Collin Grady <[EMAIL PROTECTED]> wrote: > You're importing UKPostcodeField - so why are you trying to use > models.UKPostcodeField ? :)

Re: index page

2007-08-21 Thread MikeHowarth
It really depends on how complicated you want to make it. However using generic views would easily suffice, just set up a dictionary of the objects you need to pass in. Something like: django.views.generic.simple.direct_to_template would do the job. On Aug 21, 9:12 am, Rufman <[EMAIL

localflavor - UKPostcodeField

2007-08-21 Thread MikeHowarth
Hi I came across localflavors and would like to use the UKPostcodeField for post code validation. However when I try to import this I'm getting ViewDoesNotExist errors. Within my forms.py I'm importing like so: from django.contrib.localflavor.uk.forms import UKPostcodeField I'm then

Re: Attribute Error

2007-08-20 Thread MikeHowarth
TED]> wrote: > On Sun, 2007-08-19 at 14:30 -0700, MikeHowarth wrote: > > I'll take a look at that. > > > Even commenting that line out and attempting to access self.title I'm > > still getting an attribute error thrown: 'Register' object has no > > attribute 'title' &g

Re: Attribute Error

2007-08-19 Thread MikeHowarth
not sure that user = User is doing what you would > want. I think instead you want to instantiate a new User object. All > you are doing right now is creating an alias user for User. > > On Aug 19, 3:16 pm, MikeHowarth <[EMAIL PROTECTED]> wrote: > > > Hi I was wondering wheth

Attribute Error

2007-08-19 Thread MikeHowarth
Hi I was wondering whether anyone can help me out. I'm currently creating a form to register users, what I'm finding is that when I then attempt to save the user within the Register:save method I'm getting an attribute error when trying to access the title attribute. I've tried referencing both

Re: Site Map template required?

2007-08-17 Thread MikeHowarth
Will do, thanks for your patience Malcolm On Aug 17, 5:52 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2007-08-16 at 11:03 -0700, MikeHowarth wrote: > > Malcolm > > > Thanks for your comments, indeed changing to use the sitemap view, > > then ret

Re: django-cart integration?

2007-08-16 Thread MikeHowarth
g you're going to sell. > > On Aug 16, 1:12 pm, MikeHowarth <[EMAIL PROTECTED]> wrote: > > > Importing other bits of code is still fairly new to me, I only started > > looking at django last week. > > > I basically took the files out of subversion and created

Re: django-cart integration?

2007-08-16 Thread MikeHowarth
s trying to import Teacher from that model. You need to import your > stuff from your models. > > On Aug 16, 3:02 am, "Jon Atkinson" <[EMAIL PROTECTED]> wrote: > > > On 8/15/07, MikeHowarth <[EMAIL PROTECTED]> wrote: > > > > Does anyone have exper

Re: Site Map template required?

2007-08-16 Thread MikeHowarth
, 2007-08-15 at 12:52 -0700, MikeHowarth wrote: > > I've read through the site maps documentation, and seem to have > > followed it to the letter, however I've getting a NoReverseMatch at / > > sitemap.xml error. > > Where are you getting this error from? It's not really eno

django-cart integration?

2007-08-15 Thread MikeHowarth
Does anyone have experience of integrating django-cart in to an app? I've tried adding this to my project, however soon as I use runserver I get issues with the models: name 'Teacher' is not defined Anyone any idea? --~--~-~--~~~---~--~~ You received this

Re: Generic View Pagination

2007-08-14 Thread MikeHowarth
I'd read that as well Collin and obviously totally forgotten about. I'll give that a whirl! On Aug 13, 11:54 pm, Collin Grady <[EMAIL PROTECTED]> wrote: > As the documentation for object_list says, it will append _list to > template_object_name, so you should actually be checking >

Re: SlugField not prepopulating?

2007-08-13 Thread MikeHowarth
ngosnippets.org/snippets/168/ > > Richard > > On Aug 13, 9:25 pm, MikeHowarth <[EMAIL PROTECTED]> wrote: > > > Hi > > > I was wondering whether anyone could help me, I just starting out with > > Django and am attempting to write a simple web app. Ideally I

SlugField not prepopulating?

2007-08-13 Thread MikeHowarth
Hi I was wondering whether anyone could help me, I just starting out with Django and am attempting to write a simple web app. Ideally I'd like to use a slug field populated based on the name of my product. However the slug field is not being populated, my model looks like this: class