Re: Using custom table instead of "user" in django

2009-08-19 Thread Marek Wawrzyczek
How about writting adapter to the django user class? It can have descriptor for login (getting login would return users email). While creating such user login would be set (only once, during creation) for example the following value: user id converted to string preceded by one character. For other

Using fixtures in tests

2009-08-17 Thread Marek Wawrzyczek
Hi, I've got an application called myapp In the main folder of django project there is initial_data.json file containing initial data for the application I also have file "simplefix.json" situated in myapp/fixtures containing initial data for tests Then after calling: python manage.py test mya

Re: Using model instance properties in QuerySets in ModelForm's __init__()

2009-03-31 Thread Marek Wawrzyczek
So I sloved my problem with QuerySet - while creating the ModelForm instance, there should be passed instance argument, not only POST or GET, so that the ModelForm could "know" if there should be edition of existing model or creating a new one. Regards, Marek Marek Marek Wawrzy

Using model instance properties in QuerySets in ModelForm's __init__()

2009-03-30 Thread Marek Wawrzyczek
Hi, I've got the following class: CarForm(ModelForm): def __init__(self, *args, **kwargs): super(CarForm, self).__init__(*args, **kwargs) id = self.instance.id qs = CarPhoto.objects.filter(car__id = id) self.fields['main_image'] = forms.ModelChoiceField(qs)

Re: Creating bound form and sending it to the page without validation

2009-03-25 Thread Marek Wawrzyczek
= CarPhotoForm(post) return render_to_response('cars.html', {'carForm':carForm, 'carPhotoForm':carPhotoForm}) then without calling form's is_valid method, the validation was performed after submitting form. Malcolm Tredinnick wrote: > On Mon, 20

Re: Creating bound form and sending it to the page without validation

2009-03-23 Thread Marek Wawrzyczek
t; > On Mon, 2009-03-23 at 00:59 +0100, Marek Wawrzyczek wrote: > > Hi > > > > Is there any possibility, to create an bound instance of a form (even if > > it contains fields with incorrect data) and then resend the form to the > > page without validating ? > &g

Creating bound form and sending it to the page without validation

2009-03-22 Thread Marek Wawrzyczek
Hi Is there any possibility, to create an bound instance of a form (even if it contains fields with incorrect data) and then resend the form to the page without validating ? Regards, Marek --~--~-~--~~~---~--~~ You received this message because you are subscrib

Re: Problem with uploading a ImageField through ModelForm

2009-03-09 Thread Marek Wawrzyczek
Malcolm Tredinnick wrote: > On Mon, 2009-03-09 at 13:34 +0100, Marek Wawrzyczek wrote: > [..] > > >> When I try to use FileField it works the same. How can I slove this >> problem ? >> > > You need to add a bit extra to the HTML form when file uploads

Problem with uploading a ImageField through ModelForm

2009-03-09 Thread Marek Wawrzyczek
Hi, I've got the code like this: class Photo(models.Model): image = models.ImageField(upload_to='photos') class PhotoForm(ModelForm): class Meta: model = Photo View function fragment: if request.method == 'POST': post = request.POST.copy() print 'post: %s'

Re: Why serializing to JSON doesn't work?

2009-03-06 Thread Marek Wawrzyczek
hould just stop responding to things :-) > > Anyway, since you're serializing a model, you *should* be using your > originally posted method. Use the way Marek said for anything other > than models (of course, the object has to be serializable.) > > If that doesn&#

Re: Why serializing to JSON doesn't work?

2009-03-05 Thread Marek Wawrzyczek
Thomas Guettler wrote: > > Jeff FW schrieb: > >> The serializers are for serializing querysets/models. I'm surprised >> you're not getting an error message there--are you catching all >> exceptions? >> >> What you want is in django.utils.simplejson: >> >> from django.utils.simplejson import en

Why serializing to JSON doesn't work?

2009-03-04 Thread Marek Wawrzyczek
Hello, I've got the code like this: from django.core import serializers ... ret = { } ret['a'] = 'b' json_serializer = serializers.get_serializer("json")() serialized = json_serializer.serialize(ret, ensure_ascii=False) print serialized and this doesn't print serial

Re: Help w/ installing admin on 1.0.2 on MAC OS 10.4

2009-03-02 Thread Marek Wawrzyczek
Sorry, I wanted to begin a new topic, and I've forgotten to change the subject. Best wishes, Marek --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to djang

basics: filtering with foreign key

2009-03-02 Thread Marek Wawrzyczek
Hi At: http://docs.djangoproject.com/en/dev/topics/db/queries/#spanning-multi-valued-relationships there is written: "That may sound a bit confusing, so hopefully an example will clarify. To select all blogs that contains entries with "Lennon" in the headline and were published in 2008, we

Re: Help w/ installing admin on 1.0.2 on MAC OS 10.4

2009-03-02 Thread Marek Wawrzyczek
Hi_ _ At: http://docs.djangoproject.com/en/dev/topics/db/queries/#spanning-multi-valued-relationships there is written: / "That may sound a bit confusing, so hopefully an example will clarify. To select all blogs that contains entries with "Lennon" in the headline and were published in 2008

Re: Django configuration. I can't import django.db .

2008-12-06 Thread Marek Wawrzyczek
You're very observant. Thanks :)) 2008/12/6 Karen Tracey <[EMAIL PROTECTED]> > On Sat, Dec 6, 2008 at 11:53 AM, Marek Wawrzyczek <[EMAIL PROTECTED]>wrote: > >> In the tutorial (http://docs.djangoproject.com/en/dev/intro/tutorial01/) >> I do everything what is

Re: Django configuration. I can't import django.db .

2008-12-06 Thread Marek Wawrzyczek
/utils/translation/trans_real.py", line 198, in translation default_translation = _fetch(settings.LANGUAGE_CODE) File "/usr/lib/python2.5/site-packages/django/utils/translation/trans_real.py", line 181, in _fetch app = getattr(__import__(appname[:p], {}, {}, [appname[p+1:]]),

Re: Django configuration. I can't import django.db .

2008-12-06 Thread Marek Wawrzyczek
On the page http://www.juiceanalytics.com/openjuice/django_settings_module/I've found a script and after I run the script then it worked. Regards 2008/12/6 Marek Wawrzyczek <[EMAIL PROTECTED]> > I've created a django application, and after that I get the same error. > Bef

Re: Django configuration. I can't import django.db .

2008-12-06 Thread Marek Wawrzyczek
> > > > > > > > Traceback (most recent call last): > > File "", line 1, in > > File "d:\P25\Lib\site-packages\django\db\__init__.py", line 9, in > > > > if not settings.DATABASE_ENGINE: > > > > python can't find your conf