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
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
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
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
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):
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
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
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
>
> 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
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
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
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
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
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
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,
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
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
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
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
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
>
>
>
>
>
>
>
> >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.
>
>
> 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,
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
>
> 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
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):
> >
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
> 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
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
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
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
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
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
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
> 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
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
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
@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
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
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
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)
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 %}
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.
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,
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
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
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
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
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
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
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:
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
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
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=
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!
--
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
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
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
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"
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
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
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
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
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
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
64 matches
Mail list logo