uot;Column 'country_id' cannot be null"
Or do I have to previously check if the country exists, and creating
it if it doesn't?
Thanks
jul
class Country(models.Model):
name = models.CharField(max_length=100, unique=True)
class Restaurant(models.Model):
n
hi,
in my base.html template I've got a header which needs httprequest
(request.path, request.user.is_authenticated...).
In all my views I'm passing the request object to render_to_response.
Is there any better way to do that?
But I still have to pass RequestContext(request) to render_to_response
if I'm not using generic views, right?
On Oct 21, 8:38 pm, Andrew Ingram wrote:
> jul wrote:
> > hi,
>
> > in my base.html template I've got a header which needs httprequest
> > (request.p
user from the context)?
thanks
jul
class Rating(models.Model):
user = models.ForeignKey(User)
restaurant = models.ForeignKey(Restaurant)
rating = models.PositiveSmallIntegerField()
class AddRestaurantForm(ModelForm):
rating = models.IntegerField()
class Meta:
anhttp://nomadblue.com/
>
> On Fri, Nov 13, 2009 at 5:35 AM, Andy Mckay wrote:
> > On 09-11-12 2:33 PM, jul wrote:
> >> I've got the Rating model and the AddRestaurantForm shown below. In
> >> order to add a rating when submitting a new restaurant, I added
in the
> model, I think. Also, such extra field in the form, shouldn't it be
> form.IntegerField instead of model.IntegerField?
>
> Hector Garcia - Web developer, musicianhttp://nomadblue.com/
>
> On Fri, Nov 13, 2009 at 5:35 AM, Andy Mckay wrote:
> > On 09-11-12 2:33
What happen to the rating field when doing the following?
f = AddRestaurantForm(request.POST)
f.save()
Does save() only use what it needs to fill the Restaurant instance and
doesn't use the rating value?
On Nov 13, 5:35 am, Andy Mckay wrote:
> On 09-11-12 2:33 PM, jul wrote:
>
&
pointed in his comment.
>
> Hector Garcia - Web developer, musicianhttp://nomadblue.com/
>
> On Fri, Nov 13, 2009 at 11:59 AM, jul wrote:
> > What happen to the rating field when doing the following?
>
> > f = AddRestaurantForm(request.POST)
> > f.save()
>
>
hi,
I'm generating, using ModelForm, a form from a Restaurant model, which
has a Country field.
Country has a 'code' and a 'name' fields.
When the form is created in my template, the values of the select
options are the Country ids. How can I replace them by the Country
'code' values. Is it possib
Hi,
I've got the ModelForm and Model shown below.
I'm overriding the 'city' field to get a CharField instead of a City
foreign key.
def addRestaurant(request):
if request.user.is_authenticated():
if request.method == 'POST':
form = AddRestaurantForm(request.POST)
Previous post wasn't finished. Wrong key :(
Here's the complete one:
Hi,
I've got the ModelForm and Model shown below.
I'm overriding the 'city' field to get a CharField instead of a City
foreign key.
When saving the Restaurant instance, it returns ""Restaurant.city"
must be a "City" instance".
recursion errors in
> Django, so if that gives you problems, try calling the method all by
> itself:
>
> # Finish by passing control back tot he normal Django flow:
> forms.ModelForm.save(self, commit)
>
> Tim
>
> On Nov 27, 8:57 am, jul wrote:
>
> >
thank you.
Excluding city from the ModelForm seems to work as well...
class AddRestaurantForm(ModelForm):
rating = forms.IntegerField(widget=forms.Select(choices =
RATING_CHOICE), required=False)
city = forms.CharField(max_length=100)
class Meta:
model = Restaurant
ex
taurant model
3- these instances must be returned to the template.
How can I return these objects to the javascript in my template?
I'm not using render_to_response with my objects in the context since
I think it reloads the whole template? Is that right?
thanks
jul
--
You received this mes
I'm using jQuery post:
$.post("/getRestaurant/", location,
function(data) {
/* stuff */
});
In my view, how do I convert my Restaurant array to json?
Thanks for your reply!
On Dec 2, 7:52 pm, Javier Guerra wrote:
> On Wed, Dec 2, 20
ocs.python.org/library/json.html
>
> On Dec 2, 2009, at 2:01 PM, jul wrote:
>
> > I'm using jQuery post:
>
> > $.post("/getRestaurant/", location,
> > function(data) {
> > /* stuff */
> > });
>
> > In my vie
ks for any explanation/pointer.
jul
Name:{{form.name.errors}}
{{ form.name }}
Country:{{form.country.errors}}
{{ form.country }}
--
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...@
both
cases are shown below.
thanks
jul
javascript code:
*
var is_geocoded = false;
var interval;
$(function(){
$("#submit").click(function() {
var options = {
beforeSubmit: getPosition, //
hi,
I'm using Django pagination with jQuery. I can serialize the objects
list of the pagination object, but I'd like to serialize the whole
object to get more data (page number, total number of pages...). How
can I serialize the whole pagination object?
Thanks
***javascript***
function getResta
hi,
I've got the Category model and SearchForm form shown below. In my
template I'd like to get all Category instances having a given type to
be able to separate those having different style in my CSS.
How can I do this?
thanks
Jul
**Category model***
CATEGORY_TYPE = [
(1, 'r
I meant: "to be able to separate those having different type in my
CSS. "
On Jan 29, 12:56 pm, jul wrote:
> hi,
>
> I've got the Category model and SearchForm form shown below. In my
> template I'd like to get all Category instances having a given type to
&g
rchy of my category instances
How can I do that? Do I have to do a custom
forms.CheckboxSelectMultiple()? If so, how can I access Category's
parents and type?
thanks
Jul
*Category model*
CATEGORY_TYPE = [
(1, 'region'),
(2, 'type'),
I reposted this question with more details.
On Jan 29, 12:56 pm, jul wrote:
> hi,
>
> I've got the Category model and SearchForm form shown below. In my
> template I'd like to get all Category instances having a given type to
> be able to separate those having differe
I'm submitting is not part of my database
character set. How can I handle that? Should I first check in the
clean function of the field whether all characters are included in my
database charset ? Is this not handled by django (I would expect some
error before submitting the data to the databas
Ok, I'll change my database charset.
Thanks
On Feb 27, 1:06 pm, jul wrote:
> hi,
>
> when submitting some characters in a charfield of a django form I get
> the following error (e.g. when submitting 'ś')
>
> (1267, "Illegal mix of collations (latin1_swedi
hi,
I have a multilingual site and I'd like to get some date in the
current language. With date.strftime, I get the date in english
only...
The language is set by "/i18n/setlang/".
How can I do that?
thanks
jul
--
You received this message because you are subscribed to th
Perfect. Thanks.
On Mar 2, 6:47 pm, James Bennett wrote:
> On Tue, Mar 2, 2010 at 11:19 AM, jul wrote:
> > I have a multilingual site and I'd like to get some date in the
> > current language. With date.strftime, I get the date in english
> > only...
> > The l
to save the tag field, while it is excluded.
Is the save_m2m() function supposed to save excluded fields?
Is there anything wrong in my code?
Thanks
Jul
(...)
new_restaurant = form.save(commit=False)
new_restaurant.city = city
new_restaurant.save()
tags = form.cleaned_data['tag'
using the
city value from request.POST but from further processing of the data.
It still seems to me that save_m2m() tries to save the excluded tag
field.
Thanks for your help.
jul
Traceback:
File "/var/lib/python-support/python2.5/django/core/handlers/base.py"
in get_response
92.
I'm using `ModelAdmin.save_model` to set some data from the `request`
object to my instance.
When I change an existing `Magasin` instance from the admin, I get an
`IntegrityError`, eg:
"Duplicate entry '220' for key 'PRIMARY'"
meaning that in Model.save, the instance is created, instead of
30 matches
Mail list logo