Can I add custom field to ModelForm?

2011-01-07 Thread robos85
Is it possible to add field (I want it to be visible in generated form and after post) to form which is not included in Model? I need it to make a check after form.is_valid(), but this field won't go to DB. If yes - how can I do that? -- You received this message because you are subscribed to

Django admin - action on delete

2011-01-07 Thread robos85
What action is initialized when delete link is clicked? I user save_model() to override default save action, but can't find action to override delete procedures. I need it:/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Some problem with modelform save

2011-01-03 Thread robos85
THANKS. I overlooked it. To work around this problem, every time you save a form using commit=False, Django adds a save_m2m() method to yourModelForm subclass. After you've manually saved the instance produced by the form, you can invoke save_m2m() to save the many-to-many form data. -- You

Some problem with modelform save

2011-01-03 Thread robos85
I use modelform. All works fine. Validation is ok and I want to save my form. Before saving I need to populate user_id into my modelform so i make something like this: if form.is_valid(): obj = form.save(commit=False) obj.user = request.user obj.save() It seems to be ok.

Re: Problem with validating ModelForm

2011-01-03 Thread robos85
I've written that part of form subclass: def clean_title(self): data = self.cleaned_data['title'] counter = Article.objects.filter(title__iexact = data).count() if counter > 0: raise forms.ValidationError('my message') return data Is that right? --

Re: Problem with validating ModelForm

2011-01-03 Thread robos85
Could You give me some frame, how it should be? I've never done it before:/ I have that added: def clean_title(self): data = self.cleaned_data['title'] return data But how to check if that field is unique? Is there some special way, or just to write simple query to check it? --

Re: Problem with validating ModelForm

2011-01-03 Thread robos85
Could You give me some frame, how it should be? I've never done it 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-us...@googlegroups.com. To unsubscribe from this group, send email to

Problem with validating ModelForm

2011-01-03 Thread robos85
I use ModelForm to create my form. All works fine except 1 thing - validating the unique field. Code: class Article(models.Model): ... title = models.CharField(max_length=255, unique=True, error_messages={'max_length' : 'max translation',

Multi widget?

2011-01-03 Thread robos85
Hi, what I want to do, is to add 2 widgets to 1 field. So far I have: content = forms.CharField(widget=forms.Textarea(attrs={'class':'add_editor'}),) But I also want to add some medi to it (tinymce .js files). How can I do that? -- You received this message because you are subscribed to the

ModelForm and checkbox from choices

2010-12-30 Thread robos85
In my model i have that part: ... STATUSES_CHOICES = ( (0, _(u'one')), (1, _(u'two')), (2, _(u'three')) ) ... status = models.SmallIntegerField(default=0, choices=STATUSES_CHOICES, null=True, blank=True) then in my form based on that model I wanto to make

Re: Replace URLResolver?

2010-12-28 Thread robos85
I'm also curious how to resolve this problem. I'm planing to start small site, where each user has his own subdomain (profile site). How to construct urls in that situation:) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Full text indexing in small site

2010-12-26 Thread robos85
I want to make an app, that is independent of the DB system so it would be better to use some outer fulltext index -- 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

Full text indexing in small site

2010-12-26 Thread robos85
Hi, what engine fo fulltext indexing do you recommend? Small will be rather small, about 3000-4000 unique users per day. I need to index content of articles. It's avarage about 600-800 words. Thanks for advice -- You received this message because you are subscribed to the Google Groups

Re: upload files via ajax

2010-12-23 Thread robos85
http://www.swfupload.org/ is all You need :) -- 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

Re: CSRF verification failed. Request aborted.

2010-12-22 Thread robos85
Do You pass *RequestContext* to your template during rendering it in view? Example from manual: def my_view(request): c = {} # ... return render_to_response("a_template.html", c, context_instance=RequestContext(request)) -- You received this message

Re: Errors in modelForm

2010-12-09 Thread robos85
I found that I can do it when I declare form based on model. But then I must rewrite all other errors and requirements. Is there any better way? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Errors in modelForm

2010-12-09 Thread robos85
Where can I find any info about how to customize errors messages in modelforms? I know how to do it in Form, but have no clue how to make it in modelForm. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Main model name in Admin Site

2010-12-06 Thread robos85
Is there any possibility to name the main model? I don't mean the each model class, but main wrapper for all classes in model. Now it takes the name from the application name. I want to name it by my own. -- You received this message because you are subscribed to the Google Groups "Django

Comments by guest and foreign key in model

2010-12-05 Thread robos85
Hi, I need to create comments system. Either guests and logged users can comment. How can I do that? I want to make a Foreign Key to User model but then, how to add gust's comemnts? I could make it in 2 separate tables, but it would be nice to have it in 1 table. Any ideas? -- You received this

admin static doesn't work

2010-11-30 Thread robos85
I've successfully managed to configure my django project on virtual server :) The only problem 1 have by now are admin static files:/ I have no rights to /usr/lib/python2.5/site-packages/django/contrib/ admin/media. I created symlink, but permissions block it's display. I there any way, to put my

Re: If logged in show X, if not Y

2010-11-29 Thread robos85
I there any way to name a template? For example my subtempaltes/ loginform.html - I want to name it loginform. In group work it'll be a very useful feature. I knto that {% include %} tag allows passing name - but how? On 29 Lis, 04:09, Venkatraman S wrote: > On Mon, Nov 29,

Re: If logged in show X, if not Y

2010-11-28 Thread robos85
emplate. > > Regards, > Xavier. > > Le 29 nov. 2010 à 00:53, robos85 a écrit : > > > > > > > > > I managed to make register and login on my site. Now I want to divide > > my template to parts for loggen and not logged user. > > What is the best way

If logged in show X, if not Y

2010-11-28 Thread robos85
I managed to make register and login on my site. Now I want to divide my template to parts for loggen and not logged user. What is the best way to check and display template parts for this? For example if user is not logged in: show login form but if he is logged in - in the same place show him

Re: remember me in login

2010-11-27 Thread robos85
request.session.set_expiry() it's ideal for me:) On 27 Lis, 02:01, Addy Yeow <ayeo...@gmail.com> wrote: > i use thishttp://djangosnippets.org/snippets/1881/ > > > > > > > > On Sat, Nov 27, 2010 at 8:07 AM, robos85 <prog...@gmail.com> wrote: > > Is

remember me in login

2010-11-26 Thread robos85
Is there any easy way to do remember me trigger during login? I know that there is SESSION_COOKIE_AGE but it's set site-wide. Is there any possibility to set expiration at browser close or x time? -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: confirm user by ref_has and email

2010-11-25 Thread robos85
() for x in check: print x.userprofile.register_hash And I get : 'User' object has no attribute 'userprofile' On 25 Lis, 14:43, bruno desthuilliers <bruno.desthuilli...@gmail.com> wrote: > On 25 nov, 12:55, robos85 <prog...@gmail.com> wrote: > > > I'm wonde

Re: confirm user by ref_has and email

2010-11-25 Thread robos85
EDIT - title should be: "confirm user by reg_hash and email" On 25 Lis, 12:55, robos85 <prog...@gmail.com> wrote: > I'm wondering how to confirm user by ref_hash and email. I know how to > check by ref_hash in my UserProfile model but have no idea how to > connect users

confirm user by ref_has and email

2010-11-25 Thread robos85
I'm wondering how to confirm user by ref_hash and email. I know how to check by ref_hash in my UserProfile model but have no idea how to connect users model with my UserProfile model. It's required because I'm checking email (Users) and reg_hash (UserProfile). How to resolve it? -- You received

Re: absolute url in template and url name

2010-11-24 Thread robos85
n Mayfield <jwmayfi...@gmail.com> wrote: > Pass the current Site object into the template as part of the context.  Then > you can do:  {{ current_site.domain }}{% url account_activation %} for the > absolute url. > > On Nov 24, 2010, at 8:16 AM, robos85 wrote: > > > >

Re: absolute url in template and url name

2010-11-24 Thread robos85
small correction not {{ url }} but {% url %} ? On 24 Lis, 14:01, robos85 <prog...@gmail.com> wrote: > Hi, > I'm writing an email sending module based on on templates. I have no > idea how to put absolute url to my template (for > examplehttp://domain.com/account/activate/2).

absolute url in template and url name

2010-11-24 Thread robos85
Hi, I'm writing an email sending module based on on templates. I have no idea how to put absolute url to my template (for example http://domain.com/account/activate/2). I have special url for this, named account_activation. I know how to pass variables but how to create that url? Shouls I use {{

User additional profile

2010-11-22 Thread robos85
As Django noob I successfully created user validation and managed to add user. But I also created additional table for user profile, registered it in settings. But when I save() user to create it, my additional table is still empty. How can I create that user row when adding user to users table? I

Re: Not main content on site - how to?

2010-11-21 Thread robos85
il.com> wrote: > robos85 - > there are a couple ways to go - >  - context processor: this can add a set of context variables so they > are available in every template >      - very easy to write - just a function that takes a request > object, returns a context dictionar

Not main content on site - how to?

2010-11-21 Thread robos85
I'm wondering how to make a sidebars on my site. Main content is not a problem - I use views to do that. What about the rest of site content? I want for example to have last comments, last posts, the most popular posts and the most rated. How to plan that. Which Django structures should I use?

Re: Can I inport recaptcha?

2010-11-17 Thread robos85
robo...@s27:~$ python setup.py install --home=~ python: can't open file 'setup.py': [Errno 2] No such file or directory That's what I get :/ On 17 Lis, 12:48, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Nov 17, 9:55 am, robos85 <prog...@gmail.com> wrote: > > > I'm

Re: Can I inport recaptcha?

2010-11-17 Thread robos85
Thanks :) On 17 Lis, 11:27, MikeKJ wrote: > Think it came from either django snippets or recaptcha but it is open source > and been using it for a while > as it works a treat. > > This is a mickey mouse site put together for one of my bosses that uses it >

Re: App for the index?

2010-11-17 Thread robos85
I'm also beginner. I made an index app and just added it in my urls: (r'^$', 'index.views.index'), :) On 17 Lis, 11:29, eiriks wrote: > Most tutorials I've read organize apps into a structure of this sort: > > domain.com/blog > domain.com/map > domain.com/links >

Re: Can I inport recaptcha?

2010-11-17 Thread robos85
Is it from some special source, or it's your own code:) I could search it maybe on recaptcha site? On 17 Lis, 10:40, MikeKJ wrote: > Ahh sorry m8 I forgot to add this >  in the root of your project directory add captcha.py > > which is this >

Re: Can I inport recaptcha?

2010-11-17 Thread robos85
I'm not guru in server side commands:) I have access to command line. I'm in python console but don't know what to do next to add this module. eazy_install requires root so I can't just install it:/ On 17 Lis, 10:39, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Nov 17, 9:28 am

Re: Can I inport recaptcha?

2010-11-17 Thread robos85
Yes - but import captcha gives me ERROR: Could not import index.views. Error was: No module named captcha I have to put it somewhere and want to avoid adding it as Python module but as local package On 17 Lis, 10:28, MikeKJ wrote: > you can use recaptcha directly in the

Re: Can I inport recaptcha?

2010-11-17 Thread robos85
So, it's not possible to import it just from my project dir? The only way it to ask my hosting provider to install it? I have SSH terminal but I wanted it to be more portable and put it in my project:/ On 17 Lis, 10:25, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Nov 17, 9:11 am

Can I inport recaptcha?

2010-11-17 Thread robos85
Hi, I want to use reCaptcha on my site. It requires to add recaptcha module. Is it possible to not to add this to python modules, but place somewhere in my app, and then import it from there? I placed it in my project main dir, co path looks like this: /project/ customlibs/recaptcha/... I try to

Re: The same table in 2 apps

2010-10-25 Thread robos85
Yes that's exactly what I mean. I have defined class "Links" in one of the app, and want to use it in another app (user profile) to show all user's links. After reading this links I see, that there's nothing wrong in linking models from another apps. I read that part of manual, but I didn't

The same table in 2 apps

2010-10-23 Thread robos85
Hi. I'm new in Django so I have a very simple problem. I have 1 table that will be used in 2 models (maybe more). Should I declare that table in each application's model? Or how to do that in proper way? -- You received this message because you are subscribed to the Google Groups "Django users"