Re: how to use COMMENT_APPS?

2008-09-16 Thread Thejaswi Puthraya

Hi,
On Sep 17, 3:35 am, Mother <[EMAIL PROTECTED]> wrote:
> So as per the comments init:
>
> # Attributes required in the top-level app for COMMENTS_APP
> REQUIRED_COMMENTS_APP_ATTRIBUTES = ["get_model", "get_form",
> "get_form_target"]
>
> I have this in my model.
>
> def get_model():
>     from django.contrib.comments.models import Comment
>     return Comment
>
> def get_form():
>     from django.contrib.comments.forms import CommentForm
>     return CommentForm
>
> def get_form_target():
>     return
> urlresolvers.reverse("django.contrib.comments.views.comments.post_comment")
>
> Now, is the idea that I import my own Comment model, or somehow change
> the model in that function?

This idea is for customizing your comments ie having your own comments
app. You create a django app (that you want to use for comments), then
you reference it in the settings.py by using COMMENTS_APP. Make sure
to have the three attributes above in the custom comments app
__init__.py.

That's it you are done. But let me warn you that there are still some
tickets that help make the process easier.

--
Cheers
Thejaswi Puthraya
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: akismet and the new comments app

2008-09-12 Thread Thejaswi Puthraya

On Sep 12, 7:09 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
> Has anyone tried using akismet with the new comments contrib app? I've  
> set up a signal handler to run on 'comment_will_be_posted' and check  
> the comment with akismet, and the service is insisting my test  
> comments are spam no matter what. I'm using the voidspace python  
> akismet API, and largely copying out of the comment_utils app.

http://www.djangosnippets.org/snippets/1006/

>
> I've noticed that setting build_data=True in the comment_check call  
> doesn't seem to work: that's supposed to draw values out of  
> os.environ, but it looks like those values aren't available (it  
> complains if I don't explicitly pass them in). I'm adding them  
> manually out of request.META, but the test is still coming back  
> negative. You don't get much more than 'bad!' out of Akismet, so I'm a  
> little stumped.
>
> Has anyone done this yet? Is there any reason why the appropriate  
> environment values would not be available during the  
> 'comment_will_be_posted' signal stage, or there might be some other  
> settings floating around that are poisoning the whole thing? Sorry if  
> this is an unhelpful request for help, mostly I want to know if  
> anyone's been down this road yet.
>
> Thanks,
> Eric

--
Cheers
Thejaswi Puthraya
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom Comment Form - post_comment()

2008-09-12 Thread Thejaswi Puthraya

On Sep 12, 4:55 pm, tom17 <[EMAIL PROTECTED]> wrote:
> I have a similar problem like oversize.
> like you said,
>
> "If the user is logged in and you've RequestContexts enabled, then you
> can
> easily pass the username like request.user.username "
>
> seems like it is easy but I am sorry I couldn't figure out how to pass
> it to the form..

I've opened a ticket for this and is available for review at
http://code.djangoproject.com/ticket/8803.

--
Cheers
Thejaswi Puthraya
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: reverse not working with (r'^comments/(.*)', include('django.contrib.comments.urls')),

2008-09-08 Thread Thejaswi Puthraya

On Sep 7, 6:18 pm, felix <[EMAIL PROTECTED]> wrote:
> This should be dirt simple, but isn't working:
>
> main urls.py :
>  (r'^comments/(.*)', include('django.contrib.comments.urls')),
>
> comments.urls.py :
>
> urlpatterns = patterns('django.contrib.comments.views',
>     url(r'^post/$',          'comments.post_comment',
> name='comments-post-comment'),
>   etc.
>
> in the shell:
>
> >>> from django.core.urlresolvers import reverse
>
> # neither by the function>>> 
> reverse("django.contrib.comments.views.comments.post_comment")
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/core/urlresolvers.py", line 252, in
> reverse
>     *args, **kwargs)))
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/core/urlresolvers.py", line 241, in
> reverse
>     "arguments '%s' not found." % (lookup_view, args, kwargs))
> NoReverseMatch: Reverse for ''
> with arguments '()' and keyword arguments '{}' not found.
>
> # nor by named URL>>> reverse('comments-post-comment')
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/core/urlresolvers.py", line 252, in
> reverse
>     *args, **kwargs)))
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/core/urlresolvers.py", line 241, in
> reverse
>     "arguments '%s' not found." % (lookup_view, args, kwargs))
> NoReverseMatch: Reverse for 'comments-post-comment' with arguments
> '()' and keyword arguments '{}' not found.
>
> by copying and pasting the comments/urls directly into my site's URLs,
> the lookups work correctly.
>
> today's update, django svn trunk
> Revision: 8977


Here's what I get when I try out with the auth views:

In [1]: from django.core.urlresolvers import reverse

In [2]: reverse('django.contrib.auth.views.login')
---
NoReverseMatchTraceback (most recent call
last)

/home/theju/aaa/ in ()

/home/theju/trunk/django/core/urlresolvers.py in reverse(viewname,
urlconf, args, kwargs, prefix)
250 prefix = get_script_prefix()
251 return iri_to_uri(u'%s%s' % (prefix,
get_resolver(urlconf).reverse(viewname,
--> 252 *args, **kwargs)))
253
254 def clear_url_caches():

/home/theju/trunk/django/core/urlresolvers.py in reverse(self,
lookup_view, *args, **kwargs)
239 return candidate
240 raise NoReverseMatch("Reverse for '%s' with arguments
'%s' and keyword "
--> 241 "arguments '%s' not found." % (lookup_view,
args, kwargs))
242
243 def resolve(path, urlconf=None):

NoReverseMatch: Reverse for '' with
arguments '()' and keyword arguments '{}' not found.

In [3]:

So does it mean the admin doesn't work :)

This is a bug with urlresolvers and will get solved very soon.

--
Cheers
Thejaswi Puthraya
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Comments customization

2008-09-08 Thread Thejaswi Puthraya

On Sep 8, 2:47 pm, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
> Is there any document with new comment framework customization tips?  
> I'd like to switch finally to 1.0 but I don't know how to accomplish  
> few things (or have ugly workarounds):

Well, that is one feature that hasn't been documented but will be
hopefully there before 1.1
Create a custom app and create three functions or attributes with
names:
* get_model
* get_form
* get_form_target

Then you wire up your views and urls.py much like any normal app.
Check the django.contrib.comments.__init__.py for more details.
Also check out http://code.djangoproject.com/ticket/8630.

>   * do not display preview page after succesful posting of comment, go  
> to commented document instead (currently I have redirecting view and  
> handle it in my urlconf before urlconf of django.contrib.comments is  
> imported);

Place a hidden field with name next that will redirect wherever you
wish. Support for ?next (get method) is on the cards.

>   * do not display preview page on errors, redisplay the form instead  
> (no workaround yet);

Not possible at the moment and I would request you to open a ticket
and see what the core-devs think about this.

>   * do not require email at all (I set it to empty string in my custom  
> comment form using hidden field).

Sounds ok to me but this can be easily handled with custom comments.

> These 2 workarounds seem ugly to me, but I don't know how to resolve  
> these issues. Can anybody help me here?
>
> --
> We read Knuth so you don't have to. - Tim Peters
>
> Jarek Zgoda, R, Redefine
> [EMAIL PROTECTED]

--
Cheers
Thejaswi Puthraya
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: what's wrong with my django comments?

2008-09-03 Thread Thejaswi Puthraya


On Sep 3, 8:14 pm, nonight <[EMAIL PROTECTED]> wrote:
> I have add (r'^comments/', include('django.contrib.comments.urls')) in
> the urls.py
>
> the codes in the template:
> {% load comments %}
> {% render_comment_form for user %}
>
[snipped]
>
> I don't know how to do ,who can help me ?

Did you try removing the pyc files from the the comments directory and
its sub-directories and check out?

--
Cheers
Thejaswi Puthraya
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom Comment Form - post_comment()

2008-09-02 Thread Thejaswi Puthraya

On Sep 1, 6:22 pm, oversize <[EMAIL PROTECTED]> wrote:
> Hello,
> i just had the following problem and am not sure whether this is the
> way its wants to be:
>
> I used  {% get_comment_form for foo as form %}  to build my own custom
> form. The Form is very simple because only logged in user can access
> the page where one would be able to comment. Which is why i did not
> want to have an extra field for username in the comment form; Here is
> my form:
>
>  method="post">
>   {{ form.comment.label_tag }} {{ form.comment }}
>   {{ form.object_pk }}
>   {{ form.content_type }}
>   {{ form.timestamp }}
>   {{ form.security_hash }}
> 
>
> But when i committed the form i always got the error that i have to
> pass in a username. But the user _is_ authenticated.

If the user is logged in and you've RequestContexts enabled, then you
can
easily pass the username like request.user.username

> Looking in post_comment shows that if the form does not provide a name
> field, the request.user.get_full_name() is retrieved. But as those
> fields (Firstname and Lastname) are not required by the user model my
> user did not had them filled in. And as the data["name"] variable then
> has an empty string, still. the form fails.
> Providing Firstname and Lastname for the User solves the Problem.

This is not a specific case for comments alone but to any app that
uses
the User model.

> I guess this should retrieve the username of the currently logged in
> user instead of get_full_name()?

For any general web-application, every user is expected to enter his
details like first name and last name so it's not a usual case to have
both
of them empty.

But your point has been noted, will have a discussion with the core
devs before
taking this further.

--
Cheers
Theju
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: IRC Channel

2007-11-27 Thread Thejaswi Puthraya

On Nov 27, 3:21 pm, David Reynolds <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I've just noticed that the irc channel has lost the mode that lets
> anyone set the topic, so now only ops can do it. However, there
> doesn't seem to be any ops.  Is anyone able to fix it? I wanted to
> add something about the djangosprint to the topic.

Magus or Magus- is the owner of the IRC channel. Contact him and he'll
help you do it.

Cheers
Thejaswi Puthraya
http://thejaswi.info/
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Partial Validation in newforms

2007-11-27 Thread Thejaswi Puthraya

On Nov 27, 8:32 pm, PlanarPlatypus <[EMAIL PROTECTED]>
wrote:
> Does anyone know of a clean way to do partial validation in djangos
> newforms.  I am basically after a cleaner way to do something like the
> code below.

A clarification...what do you mean by partial validation? Does it mean
that you clean each field before cleaning the form. Looks like you
have got the fundae wrong. Check out James Bennett's blog on
http://www.b-list.org/weblog/2007/nov/22/newforms/ for how newforms
work exactly.

Cheers
Thejaswi Puthraya
http://thejaswi.info/
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem subclassing forms

2007-11-27 Thread Thejaswi Puthraya

> baseForm = forms.form_for_model( MyModel )
> class Form ( baseForm ):
> extra_field = forms.CharField()
>
> I'd like to have the fields defined in MyModel and add the
> extra_field, but it doesn't work.
> Besides, I'd like to have a clear example about how to use the forms
> with files (FileField or ImageField)

Read James Bennett's post on Newforms for the solution to this
problem. http://www.b-list.org/weblog/2007/nov/25/newforms/

Cheers
Thejaswi Puthraya
http://thejaswi.info/
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Could I use django as a wiki replacement?

2007-11-27 Thread Thejaswi Puthraya

On Nov 28, 6:27 am, walterbyrd <[EMAIL PROTECTED]> wrote:
> I like wikis for quickly editing and organizing documents online. I
> hate everything else about wikis - especially markup languages that
> are not compatible with anything else.

Django has a contrib app called "markup" that has support for Textile,
ReSt and Markdown. Use those filters to convert markup to (X)HTML or
whatever you like.

> Would it be difficult to develop a django app that could edit an
> online document, or a part of that document, and easily create and
> organize new docuemnts?

I guess you already got the answer for this.

Cheers
Thejaswi Puthraya
http://thejaswi.info/
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pylucene

2007-11-27 Thread Thejaswi Puthraya

On Nov 28, 6:42 am, [EMAIL PROTECTED] wrote:
> Hello,
>
> It would be very helpful to know if the Django Dev. team has any plans
> to include support for
> Pylucene/ Django.contrib.search feature in the near future?

There is already a branch that has been created for addding
FullTextSearch capabilities of Lucene, Xapian and Hyper during Summer
of Code 2006. Check out 
http://code.djangoproject.com/wiki/TextIndexingAbstractionLayer
for more details.

Cheers
Thejaswi Puthraya
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Javascript including in django's template doesn't work

2007-11-15 Thread Thejaswi Puthraya

> I feel strange about the URL: /ajas/register/jquery.js, but I don't know how
> to get it right.

Serving static files is slightly different in Django. Check
http://www.djangoproject.com/documentation/static_files/

Cheers
Thejaswi Puthraya
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: binding data with imageupload in newforms

2007-11-14 Thread Thejaswi Puthraya

> file_data = {'mugshot': {'filename':'face.jpg'
> ...  'content': }}

f = open("somefile.jpg","r")
image_data = f.read()

file_data = {'mugshot': {'filename': 'face.jpg', 'content':
image_data}}

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Unable to Login To Admin Interface

2007-11-02 Thread Thejaswi Puthraya

On Nov 3, 3:23 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hey guys I whipped up a quick model to test Django's functionality,
> added it to my apps list, added the path for the admin interface, and
> added pass as part of my model.

Did you try uncommenting the admin URL in the urls.py file? If you
have done this step, let us know if you are getting any error and
please paste a traceback of the error to help you better.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is posted data always in order?

2007-10-18 Thread Thejaswi Puthraya

On Oct 19, 12:39 am, Ken <[EMAIL PROTECTED]> wrote:
> I've tried a couple of test cases and it appears that the data
> returned in HttpRequest.POST is ordered.

request.POST is a python dictionary and the keys need not be ordered.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: internationalization xgettext error

2007-10-15 Thread Thejaswi Puthraya

On Oct 15, 5:03 pm, AniNair <[EMAIL PROTECTED]> wrote:
[snipped]
> Please guide me/tell me where I should be looking for errors.

Refer to the Django i18n list for best support.
http://groups.google.com/group/django-i18n/

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: problem to connect with mysql...

2007-10-13 Thread Thejaswi Puthraya

Hi Hern,
[snipped]
> I actually tried deinstalling django, py-mysqldb and reinstalling
> everything from the ports (that's a freebsd machine...) and it didn't
> change anything.

Can you give us the version of mysqldb ports is trying to install.
Mysqldb >= 1.2.2 is supported.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: problem to connect with mysql...

2007-10-12 Thread Thejaswi Puthraya

Hi Hrn,

> I have an issue with msql...

I believe it is MySql and not msql

> raise ImproperlyConfigured, "Error loading MySQLdb module: %s" % e
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module: /usr/local/lib/mysql/libmysqlclient_r.so.16: Undefined symbol
> "pthread_getschedparam"

Going by the error you have got there is a "thread" problem with
MySQLdb's dependencies. Better reinstall it according to your database
configuration.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using an existing database of astronomic images

2007-10-02 Thread Thejaswi Puthraya

[snipped]
> First and before the feeding of the database, after creating my
> database in the mysql prompt by inserting SQL code could django
> analyse my clean database and create class for each table?
> with the right field type?

Try using the inspectdb command. Refer to
http://www.djangoproject.com/documentation/legacy_databases/#auto-generate-the-models
for more details.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Handling DB connect error.

2007-10-02 Thread Thejaswi Puthraya

On Oct 2, 1:47 am, handsome greg <[EMAIL PROTECTED]> wrote:
> Ok here's another quick question. How can I catch a DB connect that
> fails and perform some kind of action (display a "sorry... site's
> down" page, etc.) if the DB isn't available? I can't seem to figure it
> out. Thanks!

Use the tryexcept statements.

try:
   
except OperationalError:
  return HttpResponse("Sorry Site is down") #  you could also use
render_to_response

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: default locations for css and js files

2007-10-02 Thread Thejaswi Puthraya

On Oct 2, 6:37 am, staff-gmail <[EMAIL PROTECTED]> wrote:
> I can't figure out where to put my css and js files.  I did not want to
> hard code the media path in my settings file so it is the default ''.
> So if I put a css file in my template - where does Django look for the
> relative path ?  Any help appreciated.

The default location for serving static files (like css and js) is
specified by the media setting in the settings.py file. But most users
maintain separate directories for these and then serve them as static
files by making changes in the urls.py file.

Check out http://www.djangoproject.com/documentation/static_files/ for
more details.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Email Failure

2007-10-02 Thread Thejaswi Puthraya

On Oct 2, 8:04 am, kidormb <[EMAIL PROTECTED]> wrote:
> Thanks for the reply, but
>
> SMTP AUTH extension not supported by server.
>
> is the exact error message that I receive, which I think is
> a python error.
>

Have never come across this problem!!! Which version of Django do you
use? Django 0.96 or from the subversion repository? Can you also give
us some information about the OS you use...sometimes Windows XP
firewall blocks port 25.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Downloadable HTML documentation?

2007-09-30 Thread Thejaswi Puthraya

> A search of the group didn't turn this up, so I thought I'd ask: is
> there any way to get an HTML version of the docs other than slurping
 [snipped]
Since the documentation is in reST format you can generate the HTML
yourself. Install docutils and then use rst2html to convert the
documentation in the django package (either trunk or stable) to html.
The only problem would be that all the links wouldn't work fine.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Email Failure

2007-09-30 Thread Thejaswi Puthraya

[snipped]
> I get the error message:
>
>   SMTP AUTH extension not supported by server.

It would be helpful if you could post the exact error message.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Signals Question - Firing off an email after a save

2007-09-02 Thread Thejaswi Puthraya

> I've got a very simple model, two databases and I'm using the admin
> interface.  What I need is when one of the databases gets a change made
> to it, for an email to be sent out to a specific group (the group never
> changes, however, the subject and message content should change).

Use Django signals in conjuction with Django's mail sending
routinesfor more information on signals check out
www.mercurytide.co.uk/whitepapers/django-signals
http://code.djangoproject.com/wiki/Signals
http://feh.holsman.net/articles/2006/06/13/django-signals
and about sending mails check out
http://www.djangoproject.com/documentation/email/ (this documentation
needs to be updated...i would recommend you go through the code)

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



[ANN] Django Check Constraints

2007-09-02 Thread Thejaswi Puthraya

Hello Django Users,
I am happy to announce the release of Django Check Constraints, a
Google Summer of Code Project. This project implements Value-based and
Range-based constraints in Django's models. The project will help in
server side validation at the database-level without writing extra
lines of code. Currently it support three databases Postgresql, Sqlite
and Oracle (these databases support check constraints natively).

Here is a sample model that uses Django Check Constraints:

class Product(models.Model):
prod_name   =models.CharField(maxlength=50)
price=models.IntegerField()
discount   =models.IntegerField()
tax_percent  =models.IntegerField()
sale_start_date =models.DateField()
sale_end_date  =models.DateField()

class Meta:
constraints = (

("check_price",Check(price__gte = 0) &
Check(price__gte = 'discount')),
("check_tax",Check(tax_percent__gte =
10,tax_percent__lte = 20)),
 
("check_name",Check(name__not_in__upper = ("PRODA","PRODB","PRODC"))),
 
("check_discount_neq",Check(discount__neq = 0)),
 
("check_date",Check(sale_start_date__between =
[date(2007,01,01),date(2007,12,31)])),
 
("check_date_start",Check(sale_start_date__lte = 'sale_end_date')),

  )


The equivalent SQL generated on syncdb is (in Postgresql):

BEGIN;
CREATE TABLE "test_app_product" (
"id" serial NOT NULL PRIMARY KEY,
"prod_name" varchar(50) NOT NULL,
"price" integer NOT NULL,
"discount" integer NOT NULL,
"tax_percent" integer NOT NULL,
"sale_start_date" date NOT NULL,
"sale_end_date" date NOT NULL,
CONSTRAINT "check_price" CHECK ( ("price" >= 0) AND ("price" >=
discount) ),
CONSTRAINT "check_tax" CHECK ( ("tax_percent" <= 20) AND
("tax_percent" >= 10) ),
CONSTRAINT "check_prod_name" CHECK (upper(prod_name) not in
('PRODA','PRODB','PRODC')),
CONSTRAINT "check_discount_neq" CHECK ("discount" <> 0),
CONSTRAINT "check_date" CHECK ("sale_start_date" between date
'2007-01-01' AND date '2007-12-31'),
CONSTRAINT "check_date_start" CHECK ("sale_start_date" <=
sale_end_date)
)
;
COMMIT;

For more details you can check 
http://code.google.com/p/django-check-constraints/

On how to use it with newforms you can visit
http://thejuhyd.blogspot.com/2007/07/django-newforms-and-django-check.html
and
http://thejuhyd.blogspot.com/2007/08/django-newforms-and-django-check.html

Hoping to receive your feedback/suggestions/criticisms.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to install mysql-python

2007-08-19 Thread Thejaswi Puthraya



On Aug 19, 1:16 pm, shabda <[EMAIL PROTECTED]> wrote:
> But even that is not helping. I am on a centOS box, with python
> 2.3.4.

Since you are on CentOS and yum works...use yum to install python-
devel,mysql-devel,zlib-devel,openssl-devel

and then try compiling MySQL-python...I believe it should work.


Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to install mysql-python

2007-08-19 Thread Thejaswi Puthraya

On Aug 19, 12:52 pm, shabda <[EMAIL PROTECTED]> wrote:
> I am trying to setup django with mysql, After installing django and
> mysql I am trying to set up mysql-python.
> So I give the command
> $ easy_install MySQL-python
> And am getting a ton of errors.
> On the pagehttp://www.djangobook.com/en/beta/chapter02/, under
> comments for mysql it says,
> "Don't forget when building MySQLDB MySQL needs to be in the path. If
> it isn't you will get tons of errors. ;)"
> I think this might be my problem. How do I do this?

Mysqldb has certain dependencies to be to be fulfilled like
"build-requires = python-devel mysql-devel zlib-devel openssl-
devel" (pasting from setup.cfg).
Check if you have these dependencies installed.

Certain Linux Distributions like Debian, Ubuntu offer the latest
Mysqldb package through their package managers (don't try this if you
are on Fedora).

I would recommend you install it from 
http://sourceforge.net/projects/mysql-python

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Ajax Form Submission Trouble

2007-08-19 Thread Thejaswi Puthraya

> Thanks a bunch, but would that go into the markup or into the
> comments.js file? I'm a js newb (really bad one). I'm guessing into
> the js file, the submit button doesn't have an id. Here is my current
> comments.js filehttp://dpaste.com/17243/

It would go into your template and not into your js file...it is
recommended that you have an id for your submit button.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Ajax Form Submission Trouble

2007-08-19 Thread Thejaswi Puthraya

> I'm using mochikit

Try,

onclick="$('button_id').disabled=true;"

It is 'disabled' and not 'disable'.
Check out button properties at 
http://www.w3schools.com/htmldom/dom_obj_button.asp
According the W3Schools...disabled works since IE5.0...so I see no
reason why it shouldn't work in IE7.0

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Ajax Form Submission Trouble

2007-08-14 Thread Thejaswi Puthraya

> I seem to have some terribly stupid users that repeadtly press the
> submit button on an ajax comments form. How can clear the form after
> the user submits the message like youtube does (they are ajax'd
> aswell). I've tried onclick="this.disable=true" and all, but it
> doesn't work in IE7. Any suggestions or tips would be greatly
> appreciated.

Which Javascript library are you using??? Most javascript libraries
handle the Ajax stuff as browser independent as possible (not always
true though).

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Tutorials

2007-08-14 Thread Thejaswi Puthraya

> I have kept quite on this email group but I have a question now, I have only
> seen one tutorial for django, are there more?  I am really interested in
> learning and using django.  Anybody done any screencasts? if so can anyone
> point me in the correct direction?

Check out Django Resources...
http://code.djangoproject.com/wiki/DjangoResources
It has everything you requirehave fun and hope you love Django.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: automatic form submission

2007-08-08 Thread Thejaswi Puthraya

> 1. check a specific checkbox in the search form
> 2. submit the search form
> 3. save in a file the html source of the webpage displaying the search
> results

Try ClientForm...it is an awesome library for this purpose.
Check it out at http://wwwsearch.sourceforge.net/

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: extending django.contrib.auth

2007-08-03 Thread Thejaswi Puthraya

> Is there a way I can add some attributes to the User model in
> django.contrib.auth.models and also have those new attributes render
> in admin?

Probably you should have a look at Django-Registrationbetter to
hack on this than directly on django.contrib.auth.models.
See http://code.google.com/p/django-registration for more details.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: adding contraints on admin

2007-07-27 Thread Thejaswi Puthraya

> I really love Django admin, however how can I add customer validation
> or contraints to my models?

I am coding for the GSoC Check constraints projecthere is a link
to the project site.
http://code.google.com/p/django-check-constraints/

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: GSoC Update: [Check Constraints] New features and using it with Newforms.

2007-07-26 Thread Thejaswi Puthraya


> Some questions/considerations/feedback I would love to see
> addressed if they haven't been already (and please don't take
> them as a knock against your work...I love the idea of
> constraints and I'm pleased to see your work on them):

I was probably asked to post to the Django-users list for such
feedback.
I am open to suggestions/criticisms because they help you perform
better.

> 1) are cross-table constraints possible?  E.g.
>
> constraints = (
> ('check_manager',
> Check(user__manager__active = True)
> )
> )

Haven't thought about this yetbut now its on my todo list.

> 2) do they support boolean constructs like the Q() objects do?  E.g.
>
> constraints = (
> ('check_foo',
> Check(field__gte=100) | Check(field__lte=42)
> )
> )

This is supported.

> constraints = (
> ('check_foo',
> Check(Q(field__gte=100) | Q(field__lte=42))
> )
> )

This too I haven't thought ofstudying this feasibility.

> 3) namespacing for the constraints to prevent naming clashes?
> using your example, if a second model also has a check with a
> constraint named "check_name", the generated code will try to
> create to constraints with the same name.  I don't know if this
> is a problem in all DBs, but IIRC, at least PostgreSQL will
> kvetch at the condition.  Perhaps prefixing the constraint-name
> with the table name would solve the problem?
>
>CREATE TABLE "appname_manufacturerer" (
> ...
> CONSTRAINT "appname_manufacturer__check_name"
> CHECK ("mfg_name" like 'Merc%%'),
> ...
>);

One more item in my todo list now.

> 4) do the constraints get dropped properly when doing a DB purge
> (using "manage.py sqlclear" or "manage.py sqlreset")?

Yes they do get dropped cleanly.

Thanks for the feedback.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



GSoC Update: [Check Constraints] New features and using it with Newforms.

2007-07-26 Thread Thejaswi Puthraya

Hello Django Users,
On public request I am posting this thread in this forum
This week I worked on getting the 'like' and 'between' check
conditions into the project and also writing a lot of doctests.

So here is how to use 'like' and 'between' check constraints

class Manufacturer(models.Model):
mfg_name=   models.CharField(maxlength=50)
car_sale_start  =   models.DateField()
car_sale_end=   models.DateField()
quantity_sold   =   models.IntegerField()
car_price   =   models.IntegerField()

class Meta:
constraints = (
("check_name",Check(mfg_name__like =
'Merc*')),

("check_date",Check(car_sale_start__between =
[date(2007,1,1),date(2008,1,1)])),

("check_end_date",Check(car_sale_end__gte = 'car_sale_start')),

("check_quantity",Check(quantity_sold__gte = 0)),

("check_price",Check(car_price__between = [1000,1])),
  )

In the 'like' check data '*' matches 0 or more characters whereas '+'
matches a single character. (might go for a change, replacing '+' for
a '.')

'between' expects a two-element list which give the bounds for the
field.
The output SQL is:

CREATE TABLE "appname_manufacturer" (
"id" serial NOT NULL PRIMARY KEY,
"mfg_name" varchar(50) NOT NULL,
"car_sale_start" date NOT NULL,
"car_sale_end" date NOT NULL,
"quantity_sold" integer NOT NULL,
"car_price" integer NOT NULL,
CONSTRAINT "check_name" CHECK ("mfg_name" like 'Merc%%'),
CONSTRAINT "check_date" CHECK ("car_sale_start" between date
'2007-01-01' AND date '2008-01-01'),
CONSTRAINT "check_end_date" CHECK ("car_sale_end" >=
car_sale_start),
CONSTRAINT "check_quantity" CHECK ("quantity_sold" >= 0),
CONSTRAINT "check_price" CHECK ("car_price" between 1000 AND
1)
)
;

Here is a way of using Newforms and Django Check Constraints
http://thejuhyd.blogspot.com/2007/07/django-newforms-and-django-check...

This week I will work on adding support for the datetime field and
decide on whether to support the upper and lower functions.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to display all my post data

2007-07-23 Thread Thejaswi Puthraya

> What method do I use to see all the POST elements?

request.POST is a dictionaryuse any method that is convenient to
you.
For example:
request.POST.items()
request.POST.has_key()
etc

But remember that request.POST usually contains uncleaned dataso
might have to clean them before you use them.

Cheers
Thejaswi Puthraya


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---