Re: acces cleaned data from a dynamic form

2012-06-26 Thread het.oosten
Ok when i render {{formset}} in the template everything works fine. When i render the form fields seperately, the first field of the "dishes form" is missing. This wont be hard to figure out further. Thanks for all the help! Rob -- You received this message because you are subscribed to the Go

Re: acces cleaned data from a dynamic form

2012-06-25 Thread het.oosten
This is how the POST looks: nameu'Johnson' form-MAX_NUM_FORMS u' ' form-1-dish u'fried egg' dishu'steak' form-INITIAL_FORMS u'0' csrfmiddlewaretoken u'c12349d127dbbd44e829e756613719c' form-TOTAL_FORMSu'2' -- You received this message because you are subscribed t

Re: acces cleaned data from a dynamic form

2012-06-25 Thread het.oosten
The answer to question 1: *** 1. in the template i can only get a form with {{formset}} . {{formset.dish}} doesn't work *** Was as easy as {{formset.form.dish}} (...sighs...) >So hmm, you're re-presenting the form on the same url? I guess for >debugging that works, but generally you'd redirect he

Re: acces cleaned data from a dynamic form

2012-06-25 Thread het.oosten
Thank you for your help! > I don't understand your questions. I am sorry about that, I probably ask my question the wrong way because of my lack of experience > A formset is a set of forms. What would {{ formset.dish }} even refer to? > Only the forms inside the formset have a `dish` field. Whe

acces cleaned data from a dynamic form

2012-06-24 Thread het.oosten
Django 1.2.3 For a restaurant i want to make a form, were the user can add their address, and their order. The order part is dynamic (users can add extra fields). I used jquery.formset for this. To accomplish this i have an address form and a dishes formset: class Address(models.Model):

Re: Stuck with a dynamic form within formwizard

2012-06-24 Thread het.oosten
I saw that lots will change in formwizard in future releases of Django, and i could not get this working. Therefore i switched to Jquery formwizard http://thecodemine.org/ This plugin makes it possible to show parts of forms on different pages (and do some server side validation when switching betw

Stuck with a dynamic form within formwizard

2012-06-21 Thread het.oosten
On Django 1.2.3 i am trying to get a dynamic form working. On the first page a user have to give their address/client id and on the second page customers can order dishes for catering. To dynamically add forms on the second page i use http://code.google.com/p/django-dynamic-formset/ Here is my mo

onetoone field in admin

2012-06-04 Thread het.oosten
When i select a onetoone field in admin which has already been taken, I get an error message (already exist). This is of course expected behaviour. The problem i have is that the list to select from gets very long because all items are listed. Is there a way to hide all options that are already us

Re: Sorting the output of regroup

2012-03-11 Thread het.oosten
> > Sort the list in Python in your view. Its easier to do, easier to test > and easier to maintain. Thank you for the reply. This is indeed the best way. I left the regroup tag completely, and used some nested for loops in the template. Everything works fine now. Rob -- You received this mess

Sorting the output of regroup

2012-03-10 Thread het.oosten
I have a small cms. I have two models, one for Mainmenu items, and one for page with content with a foreignkey to the main menu items: class Mainmenu_items(models.Model): title = models.CharField(max_length=60) mainmenu_order = models.IntegerField(default='99') class Page(models.M

mobile sitemap

2011-12-15 Thread het.oosten
Google recommends to add to every entry in a mobile sitemap. Who can help me with this? -- 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 ema

Re: time part of datetime not saved

2011-09-05 Thread het.oosten
I did change the model from DateField to DateTimeField, removed the table, synced the database and restarted the wsgi instance. As I found out I should have restarted the wsgi server right after deleting the table from the database. The second time I did remove, recreate and restart in the same se

Re: time part of datetime not saved

2011-09-05 Thread het.oosten
On 5 sep, 13:40, bik...@gmail.com wrote: > Just call it a hunch, but can you try [0:8] please..? I get this error in that case TypeError: tzinfo argument must be None or of a tzinfo subclass, not type 'int' I think that the strptime works correctly, because the returned datetime is: datetime.date

Re: time part of datetime not saved

2011-09-05 Thread het.oosten
It is a python 2.4 workaround for using strptime. Without the '[0:6]' I get this error: TypeError: function takes at most 8 arguments (9 given) -- 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@goo

Re: time part of datetime not saved

2011-09-05 Thread het.oosten
Oh btw, it is all about importing a facebook eventcalendar (in icalendar format) into a database. -- 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,

Re: time part of datetime not saved

2011-09-05 Thread het.oosten
Here is a code dump (still work in progress :-) ): http://pastebin.com/szQKRw7d -- 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

time part of datetime not saved

2011-09-05 Thread het.oosten
I have a model start = models.DateTimeField() In my view I create a datetime: x = datetime.datetime(*(time.strptime(str(component.get('dtstamp')),'%Y %m%dT%H%M%SZ')[0:6])) . This return a valid datetime: >>> x datetime.datetime(2011, 9, 4, 8, 45, 32) The problem is that only the date part is sav

Re: memcached occasional errors

2011-07-26 Thread het.oosten
Thanks for the replies. I installed python-memcached through the package manager. This version was outdated. I updated python-memcached to the latest version now (1.47) When I keep getting these error messages I will look into PyLibMC. Anybody have any experience with PyLibMC and Django 1.2.4? Ro

memcached occasional errors

2011-07-25 Thread het.oosten
On the memcached mailing list they suspected this is a Django/python issue so I started a thread here. A user named dormando replied that the problem below looks like a connection failure (sock has gone null) I use memcached on a low traffic website with Django 1.2.4. Sometimes I get this error m

Re: session and caching

2011-07-13 Thread het.oosten
As always afterwards everything is very logical :-) Never used caching before. -- 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 dja

Re: session and caching

2011-07-13 Thread het.oosten
> > > > > > > > >reply to message: > >date: 13.07.2011 08:08:31 > >from: "het.oosten" > >to: "Django users" > >subject: [] Re: session and caching > > >> Are you sure because in the docs I find the opposite. > >

Re: session and caching

2011-07-13 Thread het.oosten
> Are you sure because in the docs I find the opposite. > When I read it correct this is about caching the session. I was referring to (or trying to) caching the entire webpage using a custom session key for the lay-out (I use memcached) When I look at the request headers my custom session key,

session and caching

2011-07-13 Thread het.oosten
I have site with with a lay-out depending on a session, set in my view. I first tried site-wide caching, and this obviously didn't work. The caching is not session aware, and the lay-out changes almost randomly. Therefore I tried my luck with the @vary_on_headers decorator, using my session variab

Re: merge images into a webpage

2011-07-10 Thread het.oosten
> > Just so happens I'm learning Dutch at the moment, and was able to read a lot > of the code ;p I guess that was my luck :-) -- 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. T

Re: merge images into a webpage

2011-07-10 Thread het.oosten
e across code written in nederlands ;p > > Is this what you are looking for by any chance?? > > {{plaatje.1.plaatjes_lijst}} > > On Sun, Jul 10, 2011 at 8:33 PM, het.oosten wrote: > > One addition to the above, when i do: > >        def __unicode__(self): > >      

Re: merge images into a webpage

2011-07-10 Thread het.oosten
On Jul 10, 9:28 pm, "het.oosten" wrote: > > have the variable image_list in your context which is a list, you can do > > this: > > > {{ image_list.0 }} and {{ image_list.1 }} > > This is what i tried, but the only way to show the images > is(plaatjes_lijst=ima

Re: merge images into a webpage

2011-07-10 Thread het.oosten
> have the variable image_list in your context which is a list, you can do > this: > > {{ image_list.0 }} and {{ image_list.1 }} This is what i tried, but the only way to show the images is(plaatjes_lijst=image_list): {% for x in plaatje %} {{x.plaatjes_lijst|safe}} {% endfor %} -- You received

Re: merge images into a webpage

2011-07-10 Thread het.oosten
Here is the link to pastebin: http://pastebin.com/1FuVH7Hu It is all about getting specific content for a season a user chooses (it is a site for a campground) If you need more info, i will be happy to provide. -- You received this message because you are subscribed to the Google Groups "Djang

Re: merge images into a webpage

2011-07-10 Thread het.oosten
Ok perhaps a basic question. I wrote a custom method for my model: def image_list(self): return '' % (self.image, self.alt) And i indeed get a nice list of image in the template. I want however control where the single images show up. With something like {{image. 1}} other t

Re: merge images into a webpage

2011-07-10 Thread het.oosten
Adding a method/property to my model is a thing i haven't considered. You have a good point there. I will do some more reading to find a solution in this direction. Thanks! Rob On Jul 10, 5:54 pm, Shawn Milochik wrote: > I'd rather see the contents of your __unicode__ function as a > get_absolut

Re: merge images into a webpage

2011-07-10 Thread het.oosten
Oops i posted too fastis there a better way to accomplish the above? On Jul 10, 12:41 pm, "het.oosten" wrote: > I got is working like this: > > In my model: >         titel = models.CharField(max_length=200) >         alt = models.CharField(max_leng

Re: merge images into a webpage

2011-07-10 Thread het.oosten
I got is working like this: In my model: titel = models.CharField(max_length=200) alt = models.CharField(max_length=200) plaatje = models.ImageField(upload_to='plaatjes/') menu = models.ForeignKey(Menu) seizoenen = models.ManyToManyField(Seizoenen) d

Re: merge images into a webpage

2011-07-09 Thread het.oosten
On Jul 9, 10:36 pm, Shawn Milochik wrote: > Make an iterable in your view (list or tuple) containing lists or tuples > of two items -- the text and the image link. > > Then iterate through that in your template with a 'for' tag. This doesn't work. The webpage text is one object (just one textfiel

Re: merge images into a webpage

2011-07-09 Thread het.oosten
> Would using the get_absolute_url() method on your model and then using > that in your tags work? thanks for the reply. This works when you have one dictionary and one template. I want to merge the output of two queries, and render this in a template. Query one gives me: lots of text {{ image1

merge images into a webpage

2011-07-09 Thread het.oosten
I have two models. One containing images, and one containing the text of a web page. While the text remains the same, the selection of images vary, depending on the session ( I use different themes/moods depending on the season). The selection of images works perfectly, but now i am stuck merging t

Re: Customizing error message in ModelForm

2011-04-15 Thread het.oosten
Yes indeed! Thank you very much for your help. Rob -- 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-users+unsubscr...@goog

Re: Customizing error message in ModelForm

2011-04-15 Thread het.oosten
@Martin Thank you for your reply. I tried to do this, but I still get the default error message (the custom error from the code field works as it should): from django.db import models from django.forms import ModelForm from django import forms class Prijsvraag(models.Model): naam = mode

Customizing error message in ModelForm

2011-04-15 Thread het.oosten
I want to show a custom error message in a Modelform. With a normal form I can add an error message like this: error_messages={'required': 'Vul aub een geldig Email adres in', 'invalid': 'Het email adres is niet geldig'} With a ModelForm this won't work. Is there a way to add a custom error messa

Re: processing POST data from jquery

2011-04-10 Thread het.oosten
That was exactly what i needed. I didn't think of changing the javascript data. Thank you. -- 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

processing POST data from jquery

2011-04-10 Thread het.oosten
I am trying to get a jquery form validator working. I am stuck now trying to work with the POST data. When i use a simple view for testing: def Code(request): if request.method == 'POST': message = request.POST data = dict(ok=True, msg=message)

Re: another foreignkey question

2011-03-07 Thread het.oosten
Just after I posted my question i found the solution: In the view: content = Frontpage.objects.all() In the template; {% for x in content %} Tekst: {{x.text}} {% for y in x.frontpageimages_set.all %} alt: {{ y.image }} {% endfor %} {% endfor %}

another foreignkey question

2011-03-07 Thread het.oosten
I have two models: class Frontpage(models.Model): title = models.CharField(max_length=200) text = models.TextField() def __unicode__(self): return self.title class Meta: verbose_name_plural = "Frontpage" class FrontpageImages(models.

Re: css templates

2010-12-06 Thread het.oosten
Here you find a page about serving multiple templates on the same site (and saving the preference in a session): http://www.packtpub.com/article/multiple-templates-in-django -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: main categories in menu

2010-12-04 Thread het.oosten
Thank you for explaining. This is indeed exact what I was looking for. I thought I could only pass one argument to the view. Rob On 4 dec, 18:32, wayne wrote: > > So if a user enters mydomain.com/main1/page1 --> check if main1 exists > > in the database --> render a menu of all pages which are

Re: Mobile website using Django

2010-11-18 Thread het.oosten
I have implemented a mobile site according the instructions on this site: http://www.packtpub.com/article/multiple-templates-in-django Same approach on this site: http://tech.agilitynerd.com/conditional-mobile-web-site-redirect-in-djang A different template is loaded for mobile users. When a user

re-use the sitemap.xml

2010-10-11 Thread het.oosten
I want to put a sitemap on my page with all the links for better navigation. I could write a new view to fetch all links, but is there a way to include my sitemap.xml (i use the sitemap framework) in a template? I could convert the xml to html by using xslt. -- You received this message because

Re: get_absolute_url error with sitemaps

2010-10-10 Thread het.oosten
It was as easy as: def location(self, obj): return obj['slug'] Finally :-) :-) ...is this the right way to make a good sitemap.xml file? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: get_absolute_url error with sitemaps

2010-10-10 Thread het.oosten
Ok I use a slug field to retrieve an url from the database and apperently get_absolute_url() doesn't work with slugs. I added a location to my sitemap.py which gives the following result; - http://www.example.com/{'slug': u'assortiment'} Here is my sitemap.py: from django.contrib.sitemaps im

get_absolute_url error with sitemaps

2010-10-09 Thread het.oosten
I am trying to get automatic sitemap generation working with Django 1.2.1, but i think i missed something simple. I get this error: + File "/usr/lib/python2.4/site-packages/django/contrib/sitemaps/ __init__.py", line 47, in __get return attr(obj) File "/usr/lib/python2.4/site-packages

Re: problem with twitter app

2010-04-21 Thread het.oosten
I solved it making this context_processor.py: import datetime import time from django.conf import settings from django.core.cache import cache import twitter def latest_tweet( request ): tweet = cache.get( 'tweet' ) if tweet: return {"tweet": tweet} else:

problem with twitter app

2010-04-21 Thread het.oosten
I am using python-twitter on my site. I have a problem when the Twitter site is down. This results in an error message. I did not found out if the users gets an error message or not. To use Twitter on my site I have this context_processors.py import datetime import time from django.conf import set

Re: content type printed as first line in mails

2010-03-29 Thread het.oosten
Thank you for the answers! Everything is much clearer now :-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubs

content type printed as first line in mails

2010-03-29 Thread het.oosten
When I send mails with my Django app the first line of every mail is: Content-Type: text/html; charset=utf-8 When i watch the message source i noticed that charset=utf-8 is changed into charset=3Dutf-8 I also saw that in the message header the mail is marked as: Content-Type: text/plain; charset=

Re: query a foreignkey

2010-03-20 Thread het.oosten
I translated my model into english to make everything more understandable for the list. There is were I messed up (next time i do everything in English right away). I rechecked everything after the message of Nuno and removed an error. Now everything works perfectly. Thank you Bruno and Nuno! --

Re: query a foreignkey

2010-03-19 Thread het.oosten
To clarify. If I have three houses, and house 120 has two reservations, I get a list like this: 120 121 122 120 (if all are available) If the query matches one reservation of house 120 i get a list like this: 121 122 120 House 120 should been excluded from the list though. -- You received th

Re: query a foreignkey

2010-03-19 Thread het.oosten
Thank you very much for your reply. It really makes sense to change the foreignkey, and have have changed this. The core of the problem however remains the same. Everything works fine when only one reservation per house is entered. When I enter two reservations on one house, only one one of the tw

query a foreignkey

2010-03-18 Thread het.oosten
I have this model: class House(models.Model): Huisnumber = models.CharField(max_length=3) Reservation = models.ForeignKey('Data', blank=True) def __unicode__(self): return self.Huisnumber class Data(models.Model): Name = models.CharField(max_length=30

Re: Select dates with querywhich arent already available

2010-03-16 Thread het.oosten
I think i made some progress. The first tests with this query are promising: bereik = Data.objects.exclude(Aankomst__range=(Check_aankomst, Check_vertrek), Vertrek__range=(Check_aankomst, Check_vertrek)) -- You received this message because you are subscribed to the Google Groups "Django users"

Select dates with querywhich arent already available

2010-03-16 Thread het.oosten
I want to make a simple reservation app with a arrival date en a departure date. I have this simple model: class Booking(models.Model): Houses = models.CharField(max_length=3) Reservation = models.ForeignKey('Data', blank=True) def __unicode__(self): return s

Re: modify date in django twitter app

2010-03-09 Thread het.oosten
I figured it out finally. For anybody who is interested. I have this setup for showing multiple tweets: settings.py: from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS TEMPLATE_CONTEXT_PROCESSORS = TEMPLATE_CONTEXT_PROCESSORS + ( "wieskamp.verkoop.context_processors.latest_t

Re: modify date in django twitter app

2010-03-08 Thread het.oosten
I forgot to mention that my desired output of the date is: 2010-02-22 20:46:03 On 8 mrt, 22:13, "het.oosten" wrote: > I am getting somewhere now: > > import datetime > import time > import twitter > > tweet  = twitter.Api().GetUserTimeline('username', co

Re: modify date in django twitter app

2010-03-08 Thread het.oosten
I am getting somewhere now: import datetime import time import twitter tweet = twitter.Api().GetUserTimeline('username', count=3) for s in tweet: s.date = datetime.datetime(*(time.strptime( s.created_at,"%a %b %d %H:%M:%S + %Y" )[0:6])) print [x.text for x in tweet] print [y.date for

Re: modify date in django twitter app

2010-03-08 Thread het.oosten
Thank you for the reply. When i add the [0] to tweet, the date conversion is only applied to the last tweet On 7 mrt, 23:24, Daniel Roseman wrote: > On Mar 7, 9:57 pm, "het.oosten" wrote: > > > > > I am almost done implementing tweets on my site using

modify date in django twitter app

2010-03-07 Thread het.oosten
I am almost done implementing tweets on my site using a tutorial which a found here: http://www.omh.cc/blog/2008/aug/4/adding-your-twitter-status-django-site/ The problem is that i want to modify the date output when i retrieve multiple tweets. The example above is written for retrieving only one