Contact Enquiry model expecting identity value

2009-03-22 Thread grimmus
Hi, I have a class like so class ContactEnquiry(models.Model): name = models.CharField(max_length=100) subject = models.CharField(max_length=100) email = models.EmailField() message = models.CharField(max_length=100) enquiry_date = models.DateTimeField('enquiry date') def

Re: Contact Enquiry model expecting identity value

2009-03-22 Thread grimmus
etime.datetime.now()) c.save() return HttpResponseRedirect('/contact/thanks/') if i enter an integer before cd['name'] the instance gets saved in the database but this integer should be an identity/autonumber value. On Mar 22, 8:06 pm, Alex Gaynor wrote: > On

Re: Contact Enquiry model expecting identity value

2009-03-22 Thread grimmus
into ModelForm, i havent heard of it before Thanks On Mar 22, 8:59 pm, Alex Gaynor wrote: > On Sun, Mar 22, 2009 at 3:57 PM, grimmus wrote: > > > I am creating an instance of the model in a view like so: > > > form = ContactForm(request.POST) > >        if form.is

flat page url problem

2009-04-06 Thread grimmus
Hi, I was experimenting locally using flatpages. I didnt add anything extra into the urls.py file to handle these pages and they displayed correctly in the browser (using the django runserver) When i deploy my app to apache i get the error : The current URL, , didn't match any of these. My urls

textarea in ModelForm

2009-04-06 Thread grimmus
Hi, I am trying to create a text area for a form that is generated through ModelForm. The field i have is enquiry = models.CharField(widget=models.Textarea) but i get the error 'module' object has no attribute 'Textarea' I have tried a few variations but with no luck, Any ideas ? Thanks in

Re: textarea in ModelForm

2009-04-06 Thread grimmus
class ContactForm(ModelForm): class Meta: model = ContactEnquiry exclude = ('replied','enquiry_date') Any idea why the tetxtarea isnt appearing ? On Apr 6, 8:21 pm, Alex Gaynor wrote: > On Mon, Apr 6, 2009 at 2:04 PM, grimmus wrote: > > > Hi, > >

Re: flat page url problem

2009-04-07 Thread grimmus
After reading other similar posts all i needed to change was my site_id to 2 On Apr 6, 10:36 am, grimmus wrote: > Hi, > > I was experimenting locally using flatpages. I didnt add anything > extra into the urls.py file to handle these pages and they displayed > correctly in the

Re: textarea in ModelForm

2009-04-14 Thread grimmus
, 9:48 pm, Alex Gaynor wrote: > On Mon, Apr 6, 2009 at 3:46 PM, grimmus wrote: > > > Thanks for the reply. > > > I dont get an error anymore but nothing appears now, not even a > > textbox ! Please see my model below > > > from django.db import models &

issue when creating new project on windows

2009-06-05 Thread grimmus
Hi, I am trying to run the following in dos django-admin.py startproject mysite When it press enter, the django-admin.py file opens in notepad and the script isnt executed ?? Any ideas why this is happening ? I have the following in my path setting: C:\Python26;C:\Python26\Scripts; Thanks i

Blog entry with multiple categories

2009-06-08 Thread grimmus
Hi, I have a simple blog application I would like to be able to create a post and assign it to multiple categories Currently my model looks like below. I was thinking i could render the categories in the admin as checkboxes and then check multiple ones, if required, but i am not really sure how

displaying fields from 2 related models

2009-10-13 Thread grimmus
Hi, I have a model called Link that allows the user to save a URL with a title and description. The website i am making is full of Links users have added (like a bookmarking service) class Link(models.Model): user = models.ForeignKey(User) title = models.CharField(max_length=200) lin

Re: displaying fields from 2 related models

2009-10-13 Thread grimmus
aved_link.link.pub_date }} > {% endfor %} > > (embed your HTML dress and you're done) > > Cheers! > > Hector Garcia - Web developer, musician > NomadBlue URI:http://nomadblue.com/ > > On Tue, Oct 13, 2009 at 4:23 PM, grimmus wrote: > > > Hi, > > > I have

tagging case problem

2009-10-14 Thread grimmus
Hi, I followed the excellent Web Monkey tutorial on setting up a blog using Django. It makes use of Django Tagging. If a tag is entered like 'Tag' it is not found if you search for 'tag' . I would like it so the case of the tag doesnt matter because when i apply slugify in my template the tag get

Re: tagging case problem

2009-10-14 Thread grimmus
f/models/querysets/#ref-models... > > -djibon- > > On 10/14/09, grimmus wrote: > > > > > > > Hi, > > > I followed the excellent Web Monkey tutorial on setting up a blog > > using Django. It makes use of Django Tagging. If a tag is entered like > >

check if user has already saved link

2009-10-14 Thread grimmus
Hi, I have 2 Models, Link and SaveLink. Link allows URL's with title's and descripions to be added to the site. SaveLink allows the logged in user to save their favourite links. When i output all the links on the page i would like to check if the active user has already saved the current link.

Re: check if user has already saved link

2009-10-14 Thread grimmus
of a Noob with all this (as you can probably tell !!) Thanks On Oct 14, 12:16 pm, Daniel Roseman wrote: > On Oct 14, 10:38 am, grimmus wrote: > > > > > Hi, > > > I have 2 Models, Link and SaveLink. > > > Link allows URL's with title's and descripions t

Re: check if user has already saved link

2009-10-14 Thread grimmus
ed and not user|has_saved_link:object %} The error i get now is : Caught an exception while rendering: 'RelatedManager' object has no attribute 'objects' Am i forgetting to include something else ? Thanks again On Oct 14, 2:55 pm, Daniel Roseman wrote: > On Oct 14, 1:3

Re: check if user has already saved link

2009-10-14 Thread grimmus
Thanks so much to you both, it's all working great :-) On Oct 14, 3:27 pm, "Michael P. Jung" wrote: > > return user.savelink_set.objects.filter(link=object).count() (...) > > The error i get now is  : Caught an exception while rendering: > > 'RelatedManager' object has no attribute 'objects' > >

windows localhost send email

2009-10-16 Thread grimmus
Hi, I am setting up the password reset function in my app. When i click 'Reset my password' i get the error (10061, 'No connection could be made because the target machine actively refused it') I am guessing it's because there is trouble sending the email. How can i setup my machine to be able

Re: windows localhost send email

2009-10-16 Thread grimmus
t number for exemple) > > On Fri, Oct 16, 2009 at 9:28 AM, grimmus wrote: > > > Hi, > > > I am setting up the password reset function in my app. > > > When i click 'Reset my password' i get the error > > > (10061, 'No connection could be made

edit basic user data not validating on website front end

2009-10-16 Thread grimmus
Hi, On my website i have a edit profile page, this enables users to edit 4 fields : username, first name, last name and email address. For some reason the form never validates, is it not enough just to pass the 4 fields i want to edit and leave the others as they are ? My view looks like def pr

Field in admin not editable but still visible

2009-12-04 Thread grimmus
Hi, I have a hit_count integer field on my model with a default value of 0 In the admin area i would like to show this field (to see the amount of hits) but make it not editable. Is there any easy built in way to do this ? Thanks for any tips. -- You received this message because you are subs

Session not working as i had hoped

2010-05-26 Thread grimmus
Hi, When the user enters a site for the first time they should see a flash version of the logo. All other times they should see a gif image. My home view looks like: if request.session.get('has_visited',True): visited = True else: visited = False t = loader.get_templa

ordering objects in the admin area

2010-06-08 Thread grimmus
Hi, I have a staff app that lists staff photos and their names. The client would like to be able to re-order these in the admin area easily. Ideally there would be a dropdown where the user could select between 1 and n which object should appear in what position in the list. I could add an extra

best translation solution for my project

2010-07-01 Thread grimmus
Hi, Sorry if this has been asked before, but i only seem to be finding bit's and pieces for what i am after. I have a simple website that needs to be available in English and French. I am using locale-url so all pages can have an independent url ( e.g. en/page and fr/page) There is a locale fol

Re: Newby Question: template system doesn't render form html

2010-07-01 Thread grimmus
You dont seem to be closing your input tags, add > to the end of them On Jul 1, 4:47 am, Gene wrote: > When I put a form into my template it comes back blank. Does anyone > know why? > > what is in my template > > > >     >     > > > > what I get in my browser > > -- You received this mes

Re: best translation solution for my project

2010-07-01 Thread grimmus
Thanks for the reply. I settled on django-modeltranslation, it's easy to install, well documented and fits into the admin area. Thanks again. On Jul 1, 3:46 pm, bruno desthuilliers wrote: > On 1 juil, 10:18, grimmus wrote: > > > > > Hi, > > > Sorry if this h

Calling some javascript for new visitors only

2010-07-07 Thread grimmus
Hi, I need to show a javascript lightbox popup for new visitors to my site. I presume using a cookie is the best way to achieve this. But how can i check whether the cookie exists in my template, so i can call some javascript code if it's a new visitor ? I hope i have been clear, Thanks -- Yo

'unicode' object has no attribute '_committed'

2010-08-10 Thread grimmus
Hi, I am using Django 1.2.1 I have a model called Project that contains a char field and an image field. My project used Modeltranslation so i can have an English and French version of the 2 fields. When i try and add a project in the admin i get the error: 'unicode' object has no attribute '_

Re: 'unicode' object has no attribute '_committed'

2010-08-10 Thread grimmus
Thanks for the reply, below is my Project model from django.db import models class Project(models.Model): title = models.CharField(max_length=100) path = models.CharField(max_length=100,help_text='This should be the folder name') image = models.ImageField(upload_to='/images/projects/'

Re: 'unicode' object has no attribute '_committed'

2010-08-10 Thread grimmus
I am doing it in the admin area, so i dont have any custom code. The issue might be with the Modeltranslation module. It creates extra columns for the different translations, so, for example, title has title, title_en, title_fr as rows in the DB. This applies to the image field too. Thanks for an

Re: 'unicode' object has no attribute '_committed'

2010-08-10 Thread grimmus
I just found out Modeltranslation does not support ImageField :-( http://code.google.com/p/django-modeltranslation/issues/detail?id=30 On Aug 10, 10:01 pm, grimmus wrote: > I am doing it in the admin area, so i dont have any custom code. > > The issue might be with the Modeltranslati

list out of range error

2010-09-20 Thread grimmus
Hi, On the homepage of my website i list 1 random ad in the right column. In my view i retrieve it like so: side_ad = SideAd.objects.filter(active=1).order_by("?")[0] If all ad's are inactive no object's will be returned thus creating an IndexError : list out of range I tried to wrap the above

displaying object contents in template help

2010-01-15 Thread grimmus
Hi, I have a view that gets the latest videos: videos = Video.objects.filter(category=category,active=1).order_by ('-hit_count') In my template i would like the first result to appear in the primary block and the other results to appear in the secondary block {% block primary %} SHOW FI

Re: displaying object contents in template help

2010-01-15 Thread grimmus
Excellent, thanks for the useful info On Jan 15, 3:00 pm, Daniel Roseman wrote: > On Jan 15, 1:47 pm, grimmus wrote: > > > > > Hi, > > > I have a view that gets the latest videos: > > >     videos = Video.objects.filter(category=category,active=1).ord

Display most popular video from each category

2010-01-27 Thread grimmus
Hi, On the homepage of my site i display 1 main video and then the most popular video from each of the 5 categories, which is determined by a hit count. Basically i need something like the following tv_video = Video.objects.filter(category=1).order_by('-hit_count') But i need an object returned

Re: Display most popular video from each category

2010-01-28 Thread grimmus
;     if videos: >         top_videos[i] = videos[0] > > Then, access the top videos via the top_videos dict. > > Cheers, > > Gabriel > > -- > Gabriel de Carvalho Nogueira Reis > Software Developer > +44 7907 823942 > > On Wed, Jan 27, 2010 at 3:45 PM, grim

Re: Display most popular video from each category

2010-02-01 Thread grimmus
I am still experiencing issues with this. Anyone any idea what i am doing wrong ? Thanks ! On Jan 28, 3:28 pm, Daniel Roseman wrote: > On Jan 28, 2:18 pm, grimmus wrote: > > > > > Thanks for the reply. I am having some issues outputting the fields > > now though. >

Re: Display most popular video from each category

2010-02-01 Thread grimmus
When i write out just {{video}} it outputs the id of the object, but when i try {{video.id}} or {{video.title}} i get nothing. On Feb 1, 11:03 am, grimmus wrote: > I am still experiencing issues with this. > > Anyone any idea what i am doing wrong ? > > Thanks ! > > On Ja

non stop media player on site - similar to facebook chat

2010-02-24 Thread grimmus
Hi, I'm making a site with about 6 sections, each with a different URL. The client would like a small Flash media player of song previews alongside the navigation on every page. He wants the music to play continuously even when the user navigates to another page. I'm having trouble thinking how

Creating a mailing list app with Django

2010-03-01 Thread grimmus
Hi, I have a mailing list subscription on my site. I would like to send out an email to all the people who have signed up through the site. I have a model for the subscribers and it's all fine. I am wondering how i would construct the html email in the Django admin area and send it out to all the

Re: Django with Jquery

2010-03-01 Thread grimmus
link to the Google jQuery instead of a local file (it's really fast too) http://google.com/jsapi"; />