Admin form

2008-11-25 Thread Praveen

Hi All, i am very new bie of Django, i have started work on before 3
days.
I am following DJango book. I am playing with 6 chapter "Using the
admin interface"
In my urls.py file i set the url for admin

from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Example:
# (r'^blog/', include('blog.foo.urls')),
(r"^admin/", include("django.contrib.admin.urls")),
(r"^pro/book/$", "blog.blogapp.views.bookentry"),
)

but when i am running in browser http://127.0.0.1:8000/admin its
giving me error
File "/usr/lib/python2.4/site-packages/django/core/servers/
basehttp.py", line 277, in run
self.result = application(self.environ, self.start_response)

  File "/usr/lib/python2.4/site-packages/django/core/servers/
basehttp.py", line 634, in __call__
return self.application(environ, start_response)

  File "/usr/lib/python2.4/site-packages/django/core/handlers/
wsgi.py", line 239, in __call__
response = self.get_response(request)

  File "/usr/lib/python2.4/site-packages/django/core/handlers/
base.py", line 67, in get_response
response = middleware_method(request)

  File "/usr/lib/python2.4/site-packages/django/middleware/common.py",
line 72, in process_request
urlresolvers.resolve("%s/" % request.path_info)

  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 244, in resolve
return get_resolver(urlconf).resolve(path)

  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 180, in resolve
sub_match = pattern.resolve(new_path)

  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 178, in resolve
for pattern in self.urlconf_module.urlpatterns:

  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 197, in _get_urlconf_module
self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])

ImportError: No module named urls

and when i checked manually in that directory there were no urls.py
file
in usr/lib/python2.4/site-packages/django/contrib/admin/

how may i resolve that problem. i followed each and every steps of
Django book

Thanks

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Admin in Django

2008-11-25 Thread Praveen

Hi All, i am very new bie of Django, i have started work on before 3
days.
I am following DJango book. I am playing with 6 chapter "Using the
admin interface"
In my urls.py file i set the url for admin

from django.conf.urls.defaults import *
urlpatterns = patterns('',
   # Example:
   # (r'^blog/', include('blog.foo.urls')),
   (r"^admin/", include("django.contrib.admin.urls")),
   (r"^pro/book/$", "blog.blogapp.views.bookentry"),
)

but when i am running in browser http://127.0.0.1:8000/admin its
giving me error
File "/usr/lib/python2.4/site-packages/django/core/servers/
basehttp.py", line 277, in run
   self.result = application(self.environ, self.start_response)

 File "/usr/lib/python2.4/site-packages/django/core/servers/
basehttp.py", line 634, in __call__
   return self.application(environ, start_response)

 File "/usr/lib/python2.4/site-packages/django/core/handlers/
wsgi.py", line 239, in __call__
   response = self.get_response(request)

 File "/usr/lib/python2.4/site-packages/django/core/handlers/
base.py", line 67, in get_response
   response = middleware_method(request)

 File "/usr/lib/python2.4/site-packages/django/middleware/common.py",
line 72, in process_request
   urlresolvers.resolve("%s/" % request.path_info)

 File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 244, in resolve
   return get_resolver(urlconf).resolve(path)

 File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 180, in resolve
   sub_match = pattern.resolve(new_path)

 File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 178, in resolve
   for pattern in self.urlconf_module.urlpatterns:

 File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 197, in _get_urlconf_module
   self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])

ImportError: No module named urls

and when i checked manually in that directory there were no urls.py
file
in usr/lib/python2.4/site-packages/django/contrib/admin/

how may i resolve that problem. i followed each and every steps of
Django book

Thanks
--~--~-~--~~~---~--~~
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: Admin form

2008-11-25 Thread Praveen

Hi Sadeesh,
first of all i thank you for reply me..
Sadeesh i tried your code but again i am getting module error
Traceback erro:
  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 132, in _get_callback
raise ViewDoesNotExist, "Could not import %s. Error was: %s" %
(mod_name, str(e))

ViewDoesNotExist: Could not import admin.site. Error was: No module
named admin.site
when i manually checked again then there i get one folder named admin
within contrib and that is folder so we can import the folder itself
so i saw that file inside sites folder then i tried to import like
from django.contrib.sites import admin but again same error..
Thanks

On Nov 25, 5:35 pm, "sadeesh Arumugam" <[EMAIL PROTECTED]>
wrote:
> Hi Praveen,
>
> You add these lines you can get the admin interface...
>
> Coding:
> ***
>
>   from django.conf.urls.defaults import *
>
>  # Uncomment the next two lines to enable the admin:
>
> from django.contrib import admin
>
> admin.autodiscover()
>
>  urlpatterns = patterns('',
>
>  (r'^admin/(.*)', admin.site.root),
>
> )
>
> On Tue, Nov 25, 2008 at 5:46 PM, Praveen <[EMAIL PROTECTED]>wrote:
>
>
>
>
>
> > Hi All, i am very new bie of Django, i have started work on before 3
> > days.
> > I am following DJango book. I am playing with 6 chapter "Using the
> > admin interface"
> > In my urls.py file i set the url for admin
>
> > from django.conf.urls.defaults import *
> > urlpatterns = patterns('',
> >    # Example:
> >    # (r'^blog/', include('blog.foo.urls')),
> >    (r"^admin/", include("django.contrib.admin.urls")),
> >    (r"^pro/book/$", "blog.blogapp.views.bookentry"),
> > )
>
> > but when i am running in browserhttp://127.0.0.1:8000/adminits
> > giving me error
> > File "/usr/lib/python2.4/site-packages/django/core/servers/
> > basehttp.py", line 277, in run
> >    self.result = application(self.environ, self.start_response)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/servers/
> > basehttp.py", line 634, in __call__
> >    return self.application(environ, start_response)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> > wsgi.py", line 239, in __call__
> >    response = self.get_response(request)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> > base.py", line 67, in get_response
> >    response = middleware_method(request)
>
> >  File "/usr/lib/python2.4/site-packages/django/middleware/common.py",
> > line 72, in process_request
> >    urlresolvers.resolve("%s/" % request.path_info)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 244, in resolve
> >    return get_resolver(urlconf).resolve(path)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 180, in resolve
> >    sub_match = pattern.resolve(new_path)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 178, in resolve
> >    for pattern in self.urlconf_module.urlpatterns:
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 197, in _get_urlconf_module
> >    self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
>
> > ImportError: No module named urls
>
> > and when i checked manually in that directory there were no urls.py
> > file
> > in usr/lib/python2.4/site-packages/django/contrib/admin/
>
> > how may i resolve that problem. i followed each and every steps of
> > Django book
>
> > Thanks
--~--~-~--~~~---~--~~
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: Admin in Django

2008-11-25 Thread Praveen

Thanks Sadeesh, this is what i wanted..ok let me go to your refered
site and follow each step and get back to you..

On Nov 26, 10:19 am, "Rishabh Manocha" <[EMAIL PROTECTED]> wrote:
> On Wed, Nov 26, 2008 at 10:00 AM, Praveen <[EMAIL PROTECTED]>wrote:
>
>
>
>
>
>
>
> > Hi All, i am very new bie of Django, i have started work on before 3
> > days.
> > I am following DJango book. I am playing with 6 chapter "Using the
> > admin interface"
> > In my urls.py file i set the url for admin
>
> > from django.conf.urls.defaults import *
> > urlpatterns = patterns('',
> >   # Example:
> >   # (r'^blog/', include('blog.foo.urls')),
> >   (r"^admin/", include("django.contrib.admin.urls")),
> >   (r"^pro/book/$", "blog.blogapp.views.bookentry"),
> > )
>
> > but when i am running in browserhttp://127.0.0.1:8000/adminits
> > giving me error
> > File "/usr/lib/python2.4/site-packages/django/core/servers/
> > basehttp.py", line 277, in run
> >   self.result = application(self.environ, self.start_response)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/servers/
> > basehttp.py", line 634, in __call__
> >   return self.application(environ, start_response)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> > wsgi.py", line 239, in __call__
> >   response = self.get_response(request)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> > base.py", line 67, in get_response
> >   response = middleware_method(request)
>
> >  File "/usr/lib/python2.4/site-packages/django/middleware/common.py",
> > line 72, in process_request
> >   urlresolvers.resolve("%s/" % request.path_info)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 244, in resolve
> >   return get_resolver(urlconf).resolve(path)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 180, in resolve
> >   sub_match = pattern.resolve(new_path)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 178, in resolve
> >   for pattern in self.urlconf_module.urlpatterns:
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 197, in _get_urlconf_module
> >   self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
>
> > ImportError: No module named urls
>
> > and when i checked manually in that directory there were no urls.py
> > file
> > in usr/lib/python2.4/site-packages/django/contrib/admin/
>
> > how may i resolve that problem. i followed each and every steps of
> > Django book
>
> > Thanks
>
> > The Django Book is outdated (at-least the admin part, I have not looked at
>
> others). There was a major refactor of the admin code before Django 1.0 was
> released (this was after the book was written). To get the latest
> documentation on how to use the admin site, 
> seehttp://docs.djangoproject.com/en/dev/ref/contrib/admin/#ref-contrib-a
>
> --
>
> Best,
>
> R
--~--~-~--~~~---~--~~
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: Admin form

2008-11-25 Thread Praveen

Thanks Suganthi.
Yeah i added that line too and synchronize too but same error
occured...
Could not import admin.site. Error was: No module named admin.site

On Nov 26, 10:38 am, "suganthi saravanan"
<[EMAIL PROTECTED]> wrote:
> Hi Praveen,
>
> Check it!
>
> Have you added the following line  in settings.py under the INSTALLED_APPS
>
> 'django.contrib.admin'
>
> and synchronize the table . you can view the admin login 
> fromhttp://127.0.0.1:8000/admin/
--~--~-~--~~~---~--~~
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: Admin form

2008-11-26 Thread Praveen

Hi all now i have solved my problem

from django.contrib import *
from django.contrib import admin

(r"^admin/(.*)", admin.site.root),

Thanks to all of you..

On Nov 26, 12:37 pm, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> On Nov 25, 12:16 pm, Praveen <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hi All, i am very new bie of Django, i have started work on before 3
> > days.
> > I am following DJango book. I am playing with 6 chapter "Using the
> > admin interface"
> > In my urls.py file i set the url for admin
>
> > from django.conf.urls.defaults import *
> > urlpatterns = patterns('',
> >     # Example:
> >     # (r'^blog/', include('blog.foo.urls')),
> >     (r"^admin/", include("django.contrib.admin.urls")),
> >     (r"^pro/book/$", "blog.blogapp.views.bookentry"),
> > )
>
> > but when i am running in browserhttp://127.0.0.1:8000/adminits
> > giving me error
> > File "/usr/lib/python2.4/site-packages/django/core/servers/
> > basehttp.py", line 277, in run
> >     self.result = application(self.environ, self.start_response)
>
> >   File "/usr/lib/python2.4/site-packages/django/core/servers/
> > basehttp.py", line 634, in __call__
> >     return self.application(environ, start_response)
>
> >   File "/usr/lib/python2.4/site-packages/django/core/handlers/
> > wsgi.py", line 239, in __call__
> >     response = self.get_response(request)
>
> >   File "/usr/lib/python2.4/site-packages/django/core/handlers/
> > base.py", line 67, in get_response
> >     response = middleware_method(request)
>
> >   File "/usr/lib/python2.4/site-packages/django/middleware/common.py",
> > line 72, in process_request
> >     urlresolvers.resolve("%s/" % request.path_info)
>
> >   File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 244, in resolve
> >     return get_resolver(urlconf).resolve(path)
>
> >   File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 180, in resolve
> >     sub_match = pattern.resolve(new_path)
>
> >   File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 178, in resolve
> >     for pattern in self.urlconf_module.urlpatterns:
>
> >   File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 197, in _get_urlconf_module
> >     self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
>
> > ImportError: No module named urls
>
> > and when i checked manually in that directory there were no urls.py
> > file
> > in usr/lib/python2.4/site-packages/django/contrib/admin/
>
> > how may i resolve that problem. i followed each and every steps of
> > Django book
>
> > Thanks
>
> The Django book is out of date. Are you running version 1.0? If so
> you'll need to follow the online documentation, instead of the book.
>
> Seehttp://docs.djangoproject.com/en/dev/ref/contrib/admin/--
> DR.
--~--~-~--~~~---~--~~
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: djangobook.com, chapter 5, __init__() got an unexpected keyword argument 'maxlength'

2008-12-01 Thread Praveen

write max_length instead of maxlength

On Dec 1, 1:01 pm, Roland van Laar <[EMAIL PROTECTED]> wrote:
> djan wrote:
> > Hello,
>
> > I'm following along with djangobook.com, and I have a problem in
> > chapter 5 that I cannot resolve. I am using OpenSuSE-11.0, Python
> > 2.5.2, sqlite3-3.5.7-17.1 (and incidentally, this same error occurs
> > with MySQL).
>
> > 
> >   File "$HOME/djcode/mysite/books/models.py", line 3, in 
> >     class Publisher(models.Model):
> >   File "$HOME/djcode/mysite/books/models.py", line 4, in Publisher
> >     name = models.CharField(maxlength=30)
> > TypeError: __init__() got an unexpected keyword argument 'maxlength
>
> The book is a bit outdated, maxlength should become max_length
> please do read:http://docs.djangoproject.com/en/dev/
> and:http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges
> for more information about django and the changes in 1.0
>
> Regards,
>
> Roland van Laar
--~--~-~--~~~---~--~~
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: time help (again)

2008-12-02 Thread Praveen

Before getting the value you must check of its types which type is you
can not find the difference between DateObject-StrObject so you have
to have same kind of datatype
second thing open your terminal write python
>>import datetime
>>help(datetime)
which will list you all the function.
there is one function strftime() to format your date.
so you can discard nanoseconds
>>result=date1-date2

On Dec 2, 10:50 am, humanstalker <[EMAIL PROTECTED]> wrote:
> Hi
>
> Just thought i would help out anyway even though this is solved.
>
> d = datetime.datetime.now() - datetime.datetime.strptime
> (dbValueHere,"%Y-%m-%d") # Does a date diff between today and the date
> from the DB, change "%Y-%m-%d" to suit the format of you string.Also
> make sure you set the dbValueHere or replace it with you own value.
>
> print d.seconds # Prints the seconds
> print d.days #Prints the days
>
> This allows you to get the days and seconds , its not much different
> than the other solutions presented.
>
> ~stalkerh
--~--~-~--~~~---~--~~
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: Customizing ModelForm fields appearance

2008-12-25 Thread Praveen

You can create your own template and may add extra field and use your
style sheet.

On Dec 23, 10:48 pm, sergioh  wrote:
> You can always add your own custom fields, by default they override
> the default fields that becomes with the modelform, and there is an
> optional parameter "attributes", which is used to add css class to
> your fields.
>
> On Dec 23, 9:47 am, sagi s  wrote:
>
>
>
> > I really like the concept of generating a form from a model using
> > ModelForm but would like to customize the apprearance slightly (e.g.
> > size of the TextInput etc.).
>
> > Any suggestion as to how to do this?
>
> > I looked at the forms module code but got lost in the maze of the meta
> > programming...
>
> > Thanks in advance
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Subcategory field is not saving Stackline issue

2008-12-26 Thread Praveen

Hi all i am not able to save the entry of sub_cat field

here is my model.py

class MainCategory(models.Model):
  main_cat_code= models.CharField(max_length=20,primary_key=True)
  description = models.CharField(max_length = 50,)
  def __unicode__(self):
  return self.main_cat_code

class SubCategory(models.Model):
  sub_cat_code= models.CharField(max_length=20,primary_key=True)
  main_category=models.ForeignKey(MainCategory)
  description = models.CharField(max_length = 50)
  def __unicode__(self):
  return self.description

In admin.py: i am using stackedline. and i have registered
MainCategoryAdmin

class SubInline(admin.StackedInline):
model = SubCategory
extra = 1

class MainCategoryAdmin(admin.ModelAdmin):
list_filter=['main_cat_code']
search_fields = ['main_cat_code']
inlines = [SubInline]

admin.site.register(MainCategory, MainCategoryAdmin)

Its not giving any error but when i digged into database and check the
Sub category table, i see sub_cat_code field blank or empty

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



Please have a look, sub category field is not saving

2008-12-28 Thread Praveen

Hi all i am not able to save the entry of sub_cat field

here is my model.py

class MainCategory(models.Model):
  main_cat_code= models.CharField(max_length=20,primary_key=True)
  description = models.CharField(max_length = 50,)
  def __unicode__(self):
  return self.main_cat_code

class SubCategory(models.Model):
  sub_cat_code= models.CharField(max_length=20,primary_key=True)
  main_category=models.ForeignKey(MainCategory)
  description = models.CharField(max_length = 50)
  def __unicode__(self):
  return self.description

In admin.py: i am using stackedline. and i have registered
MainCategoryAdmin

class SubInline(admin.StackedInline):
model = SubCategory
extra = 1

class MainCategoryAdmin(admin.ModelAdmin):
list_filter=['main_cat_code']
search_fields = ['main_cat_code']
inlines = [SubInline]

admin.site.register(MainCategory, MainCategoryAdmin)

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



Re: wondering how to do something similar to save_model for inline.

2008-12-28 Thread Praveen

This is your database error..

On Dec 28, 8:32 am, Timboy  wrote:
> Great link. I was really excited to try it.
>
> Here is my new inline:
> class rentalInline(admin.TabularInline):
>     model= Rent
>     extra = 3
>     raw_id_fields = ('movie',)
>     exclude = ['rented_by']
>
>     def save_formset(self, request, form, formset, change):
>         instances = formset.save(commit=False)
>         for instance in instances:
>             instance.rented_by = request.user
>             instance.save()
>         formset.save()
>
> I am still getting the same issue:
> Traceback:
> File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py"
> in get_response
>   86.                 response = callback(request, *callback_args,
> **callback_kwargs)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py"
> in root
>   157.                 return self.model_page(request, *url.split('/',
> 2))
> File "/usr/lib/python2.5/site-packages/django/views/decorators/
> cache.py" in _wrapped_view_func
>   44.         response = view_func(request, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py"
> in model_page
>   176.         return admin_obj(request, rest_of_url)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/
> options.py" in __call__
>   197.             return self.change_view(request, unquote(url))
> File "/usr/lib/python2.5/site-packages/django/db/transaction.py" in
> _commit_on_success
>   238.                 res = func(*args, **kw)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/
> options.py" in change_view
>   583.                     self.save_formset(request, form, formset,
> change=True)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/
> options.py" in save_formset
>   382.         formset.save()
> File "/usr/lib/python2.5/site-packages/django/forms/models.py" in save
>   372.         return self.save_existing_objects(commit) +
> self.save_new_objects(commit)
> File "/usr/lib/python2.5/site-packages/django/forms/models.py" in
> save_new_objects
>   407.             self.new_objects.append(self.save_new(form,
> commit=commit))
> File "/usr/lib/python2.5/site-packages/django/forms/models.py" in
> save_new
>   473.         return save_instance(form, new_obj, exclude=
> [self._pk_field.name], commit=commit)
> File "/usr/lib/python2.5/site-packages/django/forms/models.py" in
> save_instance
>   59.         instance.save()
> File "/home/richard/work/svn/moviedb/../moviedb/store/models.py" in
> save
>   91.         super(Rent, self).save(**kwargs)
> File "/usr/lib/python2.5/site-packages/django/db/models/base.py" in
> save
>   307.         self.save_base(force_insert=force_insert,
> force_update=force_update)
> File "/usr/lib/python2.5/site-packages/django/db/models/base.py" in
> save_base
>   379.                 result = manager._insert(values,
> return_id=update_pk)
> File "/usr/lib/python2.5/site-packages/django/db/models/manager.py" in
> _insert
>   138.         return insert_query(self.model, values, **kwargs)
> File "/usr/lib/python2.5/site-packages/django/db/models/query.py" in
> insert_query
>   888.     return query.execute_sql(return_id)
> File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> subqueries.py" in execute_sql
>   308.         cursor = super(InsertQuery, self).execute_sql(None)
> File "/usr/lib/python2.5/site-packages/django/db/models/sql/query.py"
> in execute_sql
>   1700.         cursor.execute(sql, params)
> File "/usr/lib/python2.5/site-packages/django/db/backends/util.py" in
> execute
>   19.             return self.cursor.execute(sql, params)
>
> Exception Type: IntegrityError at /admin/store/renter/4/
> Exception Value: null value in column "rented_by_id" violates not-null
> constraint
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Calendar

2008-12-30 Thread Praveen

Hi All,
I want to use calendar in my html template as the default admin
interface uses.

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



Re: Calendar

2008-12-30 Thread Praveen

I want a calendar on simple html page.. i do now want to use widget.
In a plain html page how we may display calendar.

Karen Tracey wrote:

> On Tue, Dec 30, 2008 at 7:51 AM, Praveen 
> wrote:
>
> >
> > Hi All,
> > I want to use calendar in my html template as the default admin
> > interface uses.
> >
>
> http://docs.djangoproject.com/en/dev/topics/forms/media/#form-media
>
> Karen
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Incorrect date value: '%2008-10-10%' while searching

2009-01-01 Thread Praveen



By product name : 

By date approval : 




views.py
import Q

def proreport(request):
query = request.GET.get('q', '')
query1 = request.GET.get('p', '')
print query
print query1
if query and query1 :
qset = (
Q(product_name__startswith=query) &
Q(date_approval__icontains=query1)
)
results = Products.objects.filter(qset).distinct()
else:
results = []
return render_to_response("admin/report/product_report.html",
{ "results": results,   "query": query, "query1": query1})

database
in table date_approval field is saving in the format of (-mm-dd)

error

when i am giving the value 2008-10-10 in text box of p

Caught an exception while rendering: Incorrect date value:
'%2008-10-10%' for column 'date_approval'
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Incorrect date value: '%2008-10-10%' while searching

2009-01-02 Thread Praveen

Yeah you are right

depending on my DB you may or may not be allowed to do a LIKE
comparison on that, try doing an exact match

Dates don't really 'contain' or 'start with'.
that doesn't really make sense, I can do lookups against the year
month or day by doing, __year, __month, or __day respectively
Dates aren't strings, unless (cough) you're in sqlite.


Matías Costa wrote:

> On Fri, Jan 2, 2009 at 7:48 AM, Praveen  
> wrote:
> >
> > 
> >
> >By product name : 
> >
> >By date approval : 
> >
> >
> > 
> >
> > views.py
> > import Q
> >
> > def proreport(request):
> >query = request.GET.get('q', '')
> >query1 = request.GET.get('p', '')
> >print query
> >print query1
> >if query and query1 :
> >qset = (
> >Q(product_name__startswith=query) &
> >Q(date_approval__icontains=query1)
> >)
> >results = Products.objects.filter(qset).distinct()
> >else:
> >results = []
> >return render_to_response("admin/report/product_report.html",
> > { "results": results,   "query": query, "query1": query1})
> >
> > database
> > in table date_approval field is saving in the format of (-mm-dd)
> >
> > error
> >
> > when i am giving the value 2008-10-10 in text box of p
> >
> > Caught an exception while rendering: Incorrect date value:
> > '%2008-10-10%' for column 'date_approval'
>
> You only can search for text inside text. Here django tries to make
> text-pattern-matching on a date type. The code should be something as
>
> qset = (
> Q(product_name__startswith=query) &
> Q(date_approval=query1)
> )
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Access records from two tables

2009-01-06 Thread Praveen

Models.py

class Listing(models.Model):
  name = models.CharField(max_length=20)
  description = models.TextField(max_length = 100)
  website = models.URLField()
  category = models.ForeignKey(Category)

class Category(models.Model):
  category_code = models.CharField(max_length = 50, primary_key=True,
blank=False)
  category_name = models.CharField(max_length = 50,)
  def __unicode__(self):
return self.category_code

i have cat_list.html which list all the category with name only as
link if some one wants to know more details he/she may click on that
link.

urls.py

(r'^category/category_view/$','mysite.library.views.categories'),
(r'^category/category_view/(?P\w+)/
$','mysite.library.views.category_info'),

views.py

def categories(request):
result_category = Category.objects.all()
return render_to_response("cat_list.html",
{'result_category':result_category})

def category_info(request, category_code):
result_category = get_object_or_404(Category, pk = category_code)
->result_listing = get_object_or_404(Listing, pk = id)
print result_category
return render_to_response("category_view.html",
{'result_category':result_category,'result_listing':result_listing})

see -->result_listing in category_info function. i want to display
some info of Listing tables of corresponding category_code.

when i use

1--> result_listing = get_object_or_404(Listing, pk = id) then i get
an error
id() takes exactly one argument (0 given)

2--> result_listing = get_object_or_404(Listing, pk = category_id)
then i am not getting the exact result cause Category(category_code)
is checking with Listing(id). it should check with category_id of
Listing tables.

i do not know how may i access corresponding records from two tables.

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



Change the url

2009-01-08 Thread Praveen

 MODELS.py

class Listing_channels(models.Model):
list_channel = models.CharField(max_length = 20)
visibility = models.BooleanField()

def __unicode__(self):
return self.list_channel

class Listing(models.Model):
name = models.CharField(max_length=20)
description = models.TextField(max_length = 100)
website = models.URLField()
timing = models.CharField(max_length=20)
channels = models.ForeignKey(Listing_channels)
visibility = models.BooleanField()

def __unicode__(self):
return self.name

   URLS.py

 (r'^category/listing_view/(?P\w+)/
$','mysite.library.views.listing_view'),

   VIEWS.py

def listing_view(request, id):
report_list = get_object_or_404(Listing_channels, pk = id)
listing_result = Listing_channels.objects.all()
r = report_list. listing_set.all()
print r
return render_to_response("list_listing.html", {'report_list' :
report_list,'r':r,'listing_result':listing_result})


list_listing.html


Sight Seeings

{%if listing_result %}
{% for n in listing_result %}
{{n.list_channel}}
{% endfor %}
{% else %}
not available
{% endif %}


 
 {% if report_list  %}

 

Sight
Seeings Details




{% for t in r %}

{{ t.name }}


{{ t.timing }}


{{ t.description }}


{{ t.website }}


{% endfor %}
  
 {% else %}
   No names found

  {% endif %}
  

I am displaying Listing_channels and Listing on same page. if some one
click on any Listing_channels the corresponding Listing must display
on same page. that is why i am also sending the Listing_channels
object to list_listing.html page. if some one click first time on
Listing_channels it shows the url http://127.0.0.1:8000/category/listing_view/1/
but second time it appends 1 at the end and the url becomes
http://127.0.0.1:8000/category/listing_view/1/1

I am trying to display like frameset left side all channels and right
side description of that channel.

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



Re: Change the url

2009-01-08 Thread Praveen

Thank you so much Malcolm.
every one gives only the link and tell to read but your style of
solving the problem is amazing. how you explained me in a nice way
that i can never ever find in djangoproject.com.
Thanks you so much malcom

On Jan 8, 3:23 pm, Malcolm Tredinnick 
wrote:
> I'm going to trim your code to what looks like the relevant portion of
> the HTML template, since that's where the easiest solution lies.
>
> On Thu, 2009-01-08 at 02:02 -0800, Praveen wrote:
>
> [...]
>
>
>
> >     list_listing.html
>
> > 
> > Sight Seeings
> > 
> > {%if listing_result %}
> >     {% for n in listing_result %}
> >         {{n.list_channel}}
> >     {% endfor %}
> > {% else %}
> >     not available
> > {% endif %}
> > 
> > 
>
> [...]
>
> > I am displaying Listing_channels and Listing on same page. if some one
> > click on any Listing_channels the corresponding Listing must display
> > on same page. that is why i am also sending the Listing_channels
> > object to list_listing.html page. if some one click first time on
> > Listing_channels it shows the 
> > urlhttp://127.0.0.1:8000/category/listing_view/1/
> > but second time it appends 1 at the end and the url becomes
> >http://127.0.0.1:8000/category/listing_view/1/1
>
> The above code fragment is putting an element in the template that looks
> like
>
>         ...
>
> That is a relative URL reference and will be relative to the URL of the
> current page (which is .../category/listing_view/1/). In other words, it
> will be appended to that URL. One solution is to change the relative
> reference to look like
>
>         ...
>
> or, in template language:
>
>         {{n.list_channel}}
>
> That assumes you will only be displaying this template
> as /listing_view/1/ (or with a different number as the final
> component), since it will *always* remove the final component and
> replace it with the id value.
>
> The alternative, which is a little less fragile, is to use the "url"
> template tag to include a URL that goes all the way back to the hostname
> portion. You could write
>
>         {{n.list_channel}}
>
> (I've put in some line breaks just to avoid unpleasant line-wrapping).
> The {% url ... %} portion will return "/category/listing_view/1/" -- or
> whatever the right n.id value is -- which will always be correct.
>
> Have a read 
> ofhttp://docs.djangoproject.com/en/dev/ref/templates/builtins/#urlif
> you're not familiar with the URL tag.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Change the url

2009-01-08 Thread Praveen

Hi Malcolm i am very new bie of Django. i read through
get_absolute_url but do not know how to use.
What you have given the answer i tried with that and its working fine
but my senior asked me what will happen if i change the site name then
every where you will have to change url
mysite.library.views.listing_view.

so they told me to use get_absolute_url

i wrote get_absolute_ul in models.py
def get_absolute_url(self):
return "/listing/%i/" % self.id
and i am trying to use in my html page template but i don't know how
to use

 {{n.list_channel}}

then again same problem. first time when some one click on link it
works fine but second time it appends the link like
http://127.0.0.1:8000/category/listing_view/3/3

Please give me some idea

On Jan 8, 3:37 pm, Praveen  wrote:
> Thank you so much Malcolm.
> every one gives only the link and tell to read but your style of
> solving the problem is amazing. how you explained me in a nice way
> that i can never ever find in djangoproject.com.
> Thanks you so much malcom
>
> On Jan 8, 3:23 pm, Malcolm Tredinnick 
> wrote:
>
>
>
> > I'm going to trim your code to what looks like the relevant portion of
> > the HTML template, since that's where the easiest solution lies.
>
> > On Thu, 2009-01-08 at 02:02 -0800, Praveen wrote:
>
> > [...]
>
> > >     list_listing.html
>
> > > 
> > > Sight Seeings
> > > 
> > > {%if listing_result %}
> > >     {% for n in listing_result %}
> > >         {{n.list_channel}}
> > >     {% endfor %}
> > > {% else %}
> > >     not available
> > > {% endif %}
> > > 
> > > 
>
> > [...]
>
> > > I am displaying Listing_channels and Listing on same page. if some one
> > > click on any Listing_channels the corresponding Listing must display
> > > on same page. that is why i am also sending the Listing_channels
> > > object to list_listing.html page. if some one click first time on
> > > Listing_channels it shows the 
> > > urlhttp://127.0.0.1:8000/category/listing_view/1/
> > > but second time it appends 1 at the end and the url becomes
> > >http://127.0.0.1:8000/category/listing_view/1/1
>
> > The above code fragment is putting an element in the template that looks
> > like
>
> >         ...
>
> > That is a relative URL reference and will be relative to the URL of the
> > current page (which is .../category/listing_view/1/). In other words, it
> > will be appended to that URL. One solution is to change the relative
> > reference to look like
>
> >         ...
>
> > or, in template language:
>
> >         {{n.list_channel}}
>
> > That assumes you will only be displaying this template
> > as /listing_view/1/ (or with a different number as the final
> > component), since it will *always* remove the final component and
> > replace it with the id value.
>
> > The alternative, which is a little less fragile, is to use the "url"
> > template tag to include a URL that goes all the way back to the hostname
> > portion. You could write
>
> >         {{n.list_channel}}
>
> > (I've put in some line breaks just to avoid unpleasant line-wrapping).
> > The {% url ... %} portion will return "/category/listing_view/1/" -- or
> > whatever the right n.id value is -- which will always be correct.
>
> > Have a read 
> > ofhttp://docs.djangoproject.com/en/dev/ref/templates/builtins/#urlif
> > you're not familiar with the URL tag.
>
> > Regards,
> > Malcolm
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Change the url

2009-01-08 Thread Praveen

Hi Briel i am totally confused now.
My senior told me to write get_absolute_url

so i wrote get_absolute_url like this
class Listing_channels(models.Model):
list_channel = models.CharField(max_length = 20)
visibility = models.BooleanField()

def __unicode__(self):
return self.list_channel

def get_absolute_url(self):
return u'/category/listing_view/%i/' % self.id

and in html template i am calling

{%if listing_result %}
{% for n in listing_result %}
 {{n.list_channel}}
{% endfor %}
{% else %}
not available
{% endif %}


so its working fine.

so now i have two mechanism one is your as you told me to write and
second one is
get_absolute_url() function.

Now my confusion is if we have another same class event_channel and
event and many more classes like this then i will have to write
get_absolute_url() for each class
and if go with you then there i need to change only in urls.py that i
think fine.

so i should go with get_absolute_url? give me the best and solid
reason so i could make understand to senior, and you know the senior
behave..


Briel wrote:

> Using urls with names will solve your problem.
>
> Basically if you change your urls.py like this:
>
> url(
> r'^category/listing_view/(?P\w+)/$',
>'mysite.library.views.listing_view',
>name = 'name_for_this_view'
> ),
>
> What I have done is to add a name to the url for convenience I also
> used the url() function. This name can now be used instead of the link
> to your view. So if you were to change the site structure, when
> changes would be made to your urlconf, django would then be able to
> figure things out for you. In this version your new link would look
> like this:
>
> {{n.list_channel}}
>
>
> In the docs you can read about it at
> url(): http://docs.djangoproject.com/en/dev/topics/http/urls/#url
> naming: http://docs.djangoproject.com/en/dev/topics/http/urls/#id2
>
> Good luck.
> -Briel
>
> On 8 Jan., 12:41, Praveen  wrote:
> > Hi Malcolm i am very new bie of Django. i read through
> > get_absolute_url but do not know how to use.
> > What you have given the answer i tried with that and its working fine
> > but my senior asked me what will happen if i change the site name then
> > every where you will have to change url
> > mysite.library.views.listing_view.
> >
> > so they told me to use get_absolute_url
> >
> > i wrote get_absolute_ul in models.py
> > � � def get_absolute_url(self):
> > � � � � return "/listing/%i/" % self.id
> > and i am trying to use in my html page template but i don't know how
> > to use
> >
> >  {{n.list_channel}} > li>
> >
> > then again same problem. first time when some one click on link it
> > works fine but second time it appends the link 
> > likehttp://127.0.0.1:8000/category/listing_view/3/3
> >
> > Please give me some idea
> >
> > On Jan 8, 3:37�pm, Praveen  wrote:
> >
> > > Thank you so much Malcolm.
> > > every one gives only the link and tell to read but your style of
> > > solving the problem is amazing. how you explained me in a nice way
> > > that i can never ever find in djangoproject.com.
> > > Thanks you so much malcom
> >
> > > On Jan 8, 3:23�pm, Malcolm Tredinnick 
> > > wrote:
> >
> > > > I'm going to trim your code to what looks like the relevant portion of
> > > > the HTML template, since that's where the easiest solution lies.
> >
> > > > On Thu, 2009-01-08 at 02:02 -0800, Praveen wrote:
> >
> > > > [...]
> >
> > > > > � � list_listing.html
> >
> > > > > 
> > > > > Sight Seeings
> > > > > 
> > > > > {%if listing_result %}
> > > > > � � {% for n in listing_result %}
> > > > > � � � � {{n.list_channel}}
> > > > > � � {% endfor %}
> > > > > {% else %}
> > > > > � � not available
> > > > > {% endif %}
> > > > > 
> > > > > 
> >
> > > > [...]
> >
> > > > > I am displaying Listing_channels and Listing on same page. if some one
> > > > > click on any Listing_channels the corresponding Listing must display
> > > > > on same page. that is why i am also sending the Listing_channels
> > > > > object to list_listing.html page. if some one click first time on
> > > > > Listing_channels it shows the 
> > > > > urlhttp://127.0.0.1:8000/category/listing_view/1/
> > > >

Re: Change the url

2009-01-08 Thread Praveen

Thank you so much Briel. Really you gave me a nice explanation and the
same think i was thinking but was not able to make understand to my
senior. let me put your idea to my senior and lets see what they say..
but really i appreciate you and for your politeness.

On Jan 8, 6:43 pm, Briel  wrote:
> Hi Praveen
> I personally would prefer naming the urls rather than using the
> get_absolute_url.
> Both can accomplish your goal, but naming the urls is a more robust
> and in other ways a better solution.
>
> If you in a week decide that the url should not be /category/... but
> instead /whatever/... you would have to recode your get_absolute_url
> method. However, if you use the names in urls, everything would still
> work after changing the urls. The reason is that when using the name
> of an url, Django will find what the absolute url will be given the
> args you use, in your example the id.
> In a way, you could say that when using named urls, django is both
> writing and running get_absolute_url for you.
>
> Another plus when using named urls, is that you can give your urls
> name that give meaning. That will make it a lot easier to understand
> what's going on in the template when you read your own code 6 months
> from now. Especially if you have several views of one model.
>
> Say you had a model for blog posts.
> Then you might want to have an url for your own blogs, another one for
> your friend's blogs ect. You could still use get_absolute_url, but
> this time, it would be harder to make and use, as you now would need
> to know what url to get. Also when reading the template it would be
> hard to see which url is being displayed. Instead using tags like
> {% url friends_blog args=x %}
> {% url your_blog args=x %}
> {% url all_blog args=x %}
> would be easy to understand after not working with the code for a long
> time.
>
> -Briel
>
>
>
> Praveen wrote:
> > Hi Briel i am totally confused now.
> > My senior told me to write get_absolute_url
>
> > so i wrote get_absolute_url like this
> > class Listing_channels(models.Model):
> >     list_channel = models.CharField(max_length = 20)
> >     visibility = models.BooleanField()
>
> >     def __unicode__(self):
> >         return self.list_channel
>
> >     def get_absolute_url(self):
> >            return u'/category/listing_view/%i/' % self.id
>
> > and in html template i am calling
>
> > {%if listing_result %}
> >     {% for n in listing_result %}
> >          {{n.list_channel}} > li>
> >     {% endfor %}
> > {% else %}
> >     not available
> > {% endif %}
> > 
>
> > so its working fine.
>
> > so now i have two mechanism one is your as you told me to write and
> > second one is
> > get_absolute_url() function.
>
> > Now my confusion is if we have another same class event_channel and
> > event and many more classes like this then i will have to write
> > get_absolute_url() for each class
> > and if go with you then there i need to change only in urls.py that i
> > think fine.
>
> > so i should go with get_absolute_url? give me the best and solid
> > reason so i could make understand to senior, and you know the senior
> > behave..
>
> > Briel wrote:
>
> > > Using urls with names will solve your problem.
>
> > > Basically if you change your urls.py like this:
>
> > >     url(
> > >         r'^category/listing_view/(?P\w+)/$',
> > >        'mysite.library.views.listing_view',
> > >        name = 'name_for_this_view'
> > >     ),
>
> > > What I have done is to add a name to the url for convenience I also
> > > used the url() function. This name can now be used instead of the link
> > > to your view. So if you were to change the site structure, when
> > > changes would be made to your urlconf, django would then be able to
> > > figure things out for you. In this version your new link would look
> > > like this:
>
> > > {{n.list_channel}}
>
> > > In the docs you can read about it at
> > > url():http://docs.djangoproject.com/en/dev/topics/http/urls/#url
> > > naming:http://docs.djangoproject.com/en/dev/topics/http/urls/#id2
>
> > > Good luck.
> > > -Briel
>
> > > On 8 Jan., 12:41, Praveen  wrote:
> > > > Hi Malcolm i am very new bie of Django. i read through
> > > > get_absolute_url but do not know how to use.
> > > > What you have given the answer i tried with that and its working fine
> > > > but my senior asked me what will ha

Re: Change the url

2009-01-09 Thread Praveen

Hi Briel again my senior gave me other idea and they gave me a nice
reason why they want me to use get_absolute_url()

Given our new understanding of what the best practice is, the workflow
for a template designer, who shouldn’t need to know or understand
programming, is:

   1. Ignore the documentation’s preference for {% url %} and use what
makes sense in a given circumstance.
   2. In order to know what makes sense in a given circumstance,
figure out whether the view you want to link to is an object detail
view or not.
   3. If it’s an object detail view, use get_absolute_url.
   4. If not, dig through the Python code to find the friendly name
your programmer has given to the view you want to link to. You’ll want
to look at URL configurations for this. Please note that these URL
configurations may be strewn across many apps, including some third-
party apps that don’t reside in your project at all. Just read the
Python import statements in your base URL configuration and you should
be able to find them. Don’t know what a Python import statement or a
base URL configuration is?
   5. Once you’ve found the friendly name, read the regular
expressions in the URL configuration to figure out what arguments need
to be passed to the {% url %} tag. It may help to find and read the
associated view function. I know you probably don't know Python or
regular expressions, but sometimes life is hard.
Construct your {% url %} tag. Use filters to parse data like dates and
times into the format expected by your view function. If the filter
you're looking for doesn't exist, you may need to write it. Except you
can't, because you don't know Python. Sorry about that.
Be very careful not to make any typos in your {% url %} tag, or you
will almost certainly face a NoReverseMatch exception, which will be
nonsense to you and very difficult to debug.

If you find yourself in a situation with designers who would have
trouble fully grasping all the steps you’ve outlined above (and that’s
no knock on the designers, that shouldn’t really be their main job),
then the job falls to the developer to make it simpler.

For the rest of the cases — namely, those where you’re dealing with a
name plus arguments and you’re going to be using it over and over (and
hence it’ll be tedious to write out a {% url %} call every time), your
friendly local developer can supply you with a shortcut in the form of
a method you can hit on an object, decorated with permalink, as often
happens with get_absolute_url.

It’s also worth noting that you can often simplify repetition within a
template by using one of the newer features of the {% url %} tag: in
the form {% url some_pattern_name arg1=foo,arg2=bar as some_url %}, it
sets the variable some_url for reuse.

So basically, to me, this comes down to developers and designers
working together to share information: designers explaining what they
need in terms of backend support, and developers explaining what
support they can provide and how to use it.


I think their points are also positive and now i am going to use
get_absolute_url().

On Jan 8, 6:43 pm, Briel  wrote:
> Hi Praveen
> I personally would prefer naming the urls rather than using the
> get_absolute_url.
> Both can accomplish your goal, but naming the urls is a more robust
> and in other ways a better solution.
>
> If you in a week decide that the url should not be /category/... but
> instead /whatever/... you would have to recode your get_absolute_url
> method. However, if you use the names in urls, everything would still
> work after changing the urls. The reason is that when using the name
> of an url, Django will find what the absolute url will be given the
> args you use, in your example the id.
> In a way, you could say that when using named urls, django is both
> writing and running get_absolute_url for you.
>
> Another plus when using named urls, is that you can give your urls
> name that give meaning. That will make it a lot easier to understand
> what's going on in the template when you read your own code 6 months
> from now. Especially if you have several views of one model.
>
> Say you had a model for blog posts.
> Then you might want to have an url for your own blogs, another one for
> your friend's blogs ect. You could still use get_absolute_url, but
> this time, it would be harder to make and use, as you now would need
> to know what url to get. Also when reading the template it would be
> hard to see which url is being displayed. Instead using tags like
> {% url friends_blog args=x %}
> {% url your_blog args=x %}
> {% url all_blog args=x %}
> would be easy to understand after not working with the code for a long
> time.
>
> -Briel
>
>
>
> Praveen wrote:
> > Hi Briel i am totally confused now.
> > My senior told me to write get_absolute_url
>
> > so i wrote

LiveSearch

2009-01-15 Thread Praveen

Hi all, how may i apply LiveSearch as Djago official sites do.

So far i have tried.
I have created full-text index for Listing_channels
l=Listing_channels.objects.filter(list_channel__search='Bowling')
its working but i do not want to search for particular table.

some one suggested me to inherit all the table from base table or
apply search query on each table and combine the result. but this is
really awkward.

is there any other alternative way.
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



how may i write Recursion for this

2009-01-21 Thread Praveen

class Listing_channels(models.Model):
  list_parent_id = models.IntegerField(blank = True)
  list_channel = models.CharField(max_length = 20)
  visibility = models.BooleanField()
  index = djangosearch.ModelIndex(text=['list_channel'], additional=
[])

  def __unicode__(self):
return self.list_channel

  def get_absolute_url(self):
return u'%s' % self.list_channel

these are the records of list_channel

id   list_parent_id   list_channel
1   0 Top Menu
2   1 Sight Seeing
3   1 Real Estate
4   1 Shopping
5   1 Restaurants
6   2 Activities
7   2 Amusement park 1
8   2 Art Galleries
9   2 Museums
10   2 Parks
11   2 Tour operators
12   6 Bowling
13   6 Dinner Cruises
14   6 Diving
15   3 Developers
16   3 Orientation
17   3 Real Estate Agents
18   3 Relocation

I wanted to print like this for Sight Seeing see here
http://explocity.in/Dubai/sightseeing/activites/diving-sightseeing.html

i wrote in views.py

def latest_listing(request):
  listing_result = Listing_channels.objects.all().filter
(list_channel='Sight Seeing')
  for n in listing_result:
 print "N1.id : ", n.id
   if n.list_channel:
   qset=(
   Q(list_parent_id = n.id)
   )
level2 = Listing_channels.objects.filter(qset).distinct()
for n in level2:
   print "N2.id : ", n.id
   if n.list_channel:
   qset=(
   Q(list_parent_id = n.id)
   )
print "QSET : ", qset
level3 = Listing_channels.objects.filter(qset).distinct()
for n in level3:
   print "N3.id : ", n.id
   if n.list_channel:
   qset=(
   Q(list_parent_id = n.id)
   )
level4 = Listing_channels.objects.filter(qset).distinct()
  #sight_result = Listing_channels.objects.all().filter
(list_parent_id=6)
  print "Listing Result : ", listing_result
  print "Level2 : ", level2
  print "Level3 : ", level3
  print "Level4 : ", level4
  #print "Sight Result : ", sight_result
  return render_to_response('sight_seeing.html',
{'listing_result':listing_result,'level2':level2,'level3':level3})

its printing me well up to level2
Sight Seeing
  Activities
 ---
 ---
  Amusement park
  Art Galleries
  Museums
  Parks
  Tour operators

but for Activities(Level3) it returns me blank list.
I know what is the problem in level3 iteration it goes to last id and
there is no parent_id. but for 6,7,8 there is parent id.

my output is

N1.id :  2
N2.id :  6
N2.id :  7
N2.id :  8
N2.id :  9
N2.id :  10
N2.id :  11
QSET :  (AND: ('list_parent_id', 11L))
Listing Result :  []
Level2 :  [, , , , , ]
Level3 :  []
Level4 :  []


my query is how may i get the value for Level3.

Please do not suggest me to use django-tree or mptt.

some one told me to use recursion i do not know how to do?

if you look for a while you will come to know where i hang up.

Thanks

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



Re: how may i write Recursion for this

2009-01-21 Thread Praveen

Hi Malcolm

Thanks for reply.

whatever you said i do agree.

I do not have huge dataset. whatevere i have given the records in table
(See earlier message of this discussion) that is fixed not going to be
expand.
as you said i wrote Level3 inside Level2

def latest_listing(request):
listing_result = Listing_channels.objects.all().filter
(list_channel='Sight Seeing')
for n in listing_result:
   print "N1.id : ", n.id
   if n.list_channel:
   qset=(
   Q(list_parent_id = n.id)
   )
level2 = Listing_channels.objects.filter(qset).distinct()
for n in level2:
   print "N2.id : ", n.id
   if n.list_channel:
   qset=(
   Q(list_parent_id = n.id)
   )
   print "QSET : ", qset
   level3 = Listing_channels.objects.filter(qset).distinct
()
   for n in level3:
print "N3.id : ", n.id
if n.list_channel:
qset=(Q(list_parent_id = n.id))

level4 = Listing_channels.objects.filter(qset).distinct()
#sight_result = Listing_channels.objects.all().filter
(list_parent_id=6)
print "Listing Result : ", listing_result
print "Level2 : ", level2
print "Level3 : ", level3
print "Level4 : ", level4
#print "Sight Result : ", sight_result
#return render_to_response('sight_seeing.html',
{'listing_result':listing_result,'level2':level2,'level3':level3})
return render_to_response('sight_seeing.html',
{'listing_result':listing_result})

But even though my 'level3' list is empty.

here is my output

N1.id :  2
N2.id :  6
QSET :  (AND: ('list_parent_id', 6L))
N3.id :  12
N3.id :  13
N3.id :  14
N2.id :  7
QSET :  (AND: ('list_parent_id', 7L))
N2.id :  8
QSET :  (AND: ('list_parent_id', 8L))
N2.id :  9
QSET :  (AND: ('list_parent_id', 9L))
N2.id :  10
QSET :  (AND: ('list_parent_id', 10L))
N2.id :  11
QSET :  (AND: ('list_parent_id', 11L))
Listing Result :  []
Level2 :  [, , , , , ]
Level3 :  []
Level4 :  []


I tried in other way too

def latest_listing(request):
channels = Listing_channels.objects.all().filter(parent_id=0)
res={}
print channels
for channel in channels:
subchannels = getsubchannels(channel.id)
if subchannels:
for subchannel in subchannels:
#res[subchannel.list_channel]=[]
categorys = getsubcategory(subchannel.id)
if categorys:
result=[]
for category in categorys:
result.append(category.list_channel)
res[subchannel.list_channel]=result
print res
return render_to_response("Restaurants.html",
{'channels':channels,'result':result,'res':res})

def getsubchannels(channel):
channels = Listing_channels.objects.all()
for n in channels:
if n.list_channel:
qset = (
  Q(parent_id = channel)
)
subchannels = Listing_channels.objects.filter(qset).distinct()
return subchannels

def getsubcategory(channel):
channels = Listing_channels.objects.all()
for n in channels:
if n.list_channel:
qset = (
  Q(parent_id = channel)
)
subchannels = Listing_channels.objects.filter(qset).distinct()
return subchannels



On Jan 21, 2:26 pm, Malcolm Tredinnick 
wrote:
> On Wed, 2009-01-21 at 00:43 -0800, Praveen wrote:
> > class Listing_channels(models.Model):
> >   list_parent_id = models.IntegerField(blank = True)
> >   list_channel = models.CharField(max_length = 20)
> >   visibility = models.BooleanField()
> >   index = djangosearch.ModelIndex(text=['list_channel'], additional=
> > [])
>
> >   def __unicode__(self):
> >     return self.list_channel
>
> >   def get_absolute_url(self):
> >     return u'%s' % self.list_channel
>
> > these are the records of list_channel
>
> > id   list_parent_id   list_channel
> > 1       0     Top Menu
> > 2       1     Sight Seeing
> > 3       1     Real Estate
> > 4       1     Shopping
> > 5       1     Restaurants
> > 6       2     Activities
> > 7       2     Amusement park 1
> > 8       2     Art Galleries
> > 9       2     Museums
> > 10       2     Parks
> &

UserProfile with django-registration

2009-02-02 Thread Praveen
e(template_name,
  { 'form': form },
  context_instance=context)
create_profile = login_required(create_profile)

urls.py
---
urlpatterns = patterns('',
(r'^accounts/', include('registration.urls')),
#(r'^accounts/register/$','foodies.foodapp.regview.regform'),
(r'^static/(?P.*)$', 'django.views.static.serve',
{'document_root': 'static'}),
(r'^login/$', 'foodies.foodapp.regview.login'),
(r'^events/$', 'foodies.foodapp.eventview.event'),
(r'^profile/$', 'foodies.foodapp.regview.create_profile'),
)

when i am running http://127.0.01:8000/profile

error:
UnboundLocalError at /profile/

local variable 'form' referenced before assignment

Request Method: GET
Request URL:http://127.0.0.1:8000/profile/
Exception Type: UnboundLocalError
Exception Value:

local variable 'form' referenced before assignment

Exception Location: /home/praveen/foodies/../foodies/foodapp/
regview.py in create_profile, line 127

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



Custom User Profile

2009-02-02 Thread Praveen

Hi every one
I am using django-registration application which is working fine with
fields(username,password,email,first_name,last_name).
I wanted to add some more fields like age,phone while registration
time or i may create seperate profile with that particular user.

models.py
-

class ProfileManager(models.Manager):
def profile_callback(self, user):
new_profile = UserProfile.objects.create
(user=user,age=age,first_name=first_name,last_name=last_name)

class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True, verbose_name=_('user'))
gender = models.CharField(_('gender'), max_length=1,
choices=GENDER_CHOICES)
age = models.IntegerField(_('age'), max_length=3, unique=True,
help_text=_("Numeric characters only"))
first_name = models.CharField(_('first name'), max_length=30,
blank=True)
last_name = models.CharField(_('last name'), max_length=30,
blank=True)
objects = ProfileManager()
def __unicode__(self):
return u"Registration information for %s" % self.user

def get_absolute_url(self):
return ('profiles_profile_detail', (), { 'username':
self.user.username })

forms.py
---

from django.contrib.auth.models import User

from foodies.foodapp.models import UserProfile
attrs_dict = { 'class': 'required' }

class ProfileForm(forms.Form):
"""
Subclasses should feel free to add any additional validation
theyneed, but should either preserve the base ``save()`` or
implement
a ``save()`` which accepts the ``profile_callback`` keyword
argument and passes it through to
``RegistrationProfile.objects.create_inactive_user()``.
"""
username = forms.RegexField(regex=r'^\w+$',
max_length=30,
widget=forms.TextInput
(attrs=attrs_dict),
label=_(u'username'))
#gender = forms.CharField(label = _('Gender'), widget =
forms.Select(choices=UserProfile.GENDER_CHOICES))
age = forms.EmailField(widget=forms.TextInput(attrs=dict
(attrs_dict,
 
maxlength=75)),
 label=_(u'email address'))
first_name = forms.CharField(widget=forms.PasswordInput
(attrs=attrs_dict, render_value=False),
label=_(u'password'))
last_name = forms.CharField(widget=forms.PasswordInput
(attrs=attrs_dict, render_value=False),
label=_(u'password (again)'))

def clean_username(self):
""" Validate that the username is alphanumeric and is not
already in use.  """
try:
user = User.objects.get(username__iexact=self.cleaned_data
['username'])
except User.DoesNotExist:
return self.cleaned_data['username']
raise forms.ValidationError(_(u'This username is already
taken. Please choose another.'))

def save(self, user):
user_obj = User.objects.get(pk=user.id)
user_obj.first_name = self.cleaned_data['first_name']
user_obj.last_name = self.cleaned_data['last_name']
try:
profile_obj = user.get_profile()
except ObjectDoesNotExist:
profile_obj = UserProfile()
profile_obj.user = user
profile_obj.birthdate = self.cleaned_data['birthdate']
profile_obj.gender = self.cleaned_data['gender']
profile_obj.save()
user_obj.save()

def create_profile(request, form_class=ProfileForm, success_url=None,
   template_name='registration/profile.html',
   extra_context=None,profile_callback=None,):
print " I am inside profile"
try:
profile_obj = request.user.get_profile()
print "Profile obj : ", form_class
return HttpResponseRedirect(reverse('profiles_edit_profile'))
except ObjectDoesNotExist:
pass

'''if success_url is None:
success_url = reverse('profiles_profile_detail',
  kwargs={ 'username':
request.user.username })'''
'''if form_class is None:
form_class = utils.get_profile_form()'''
if request.method == 'POST':
form = form_class(data=request.POST, files=request.FILES)
if form.is_valid():
profile_obj = form.save(commit=False)
profile_obj.user = request.user
profile_obj.save()
if hasattr(form, 'save_m2m'):
form.save_m2m()
return HttpResponseRedirect(success_url)
else:
form = form_class()

if extra_context is None:
extra_context = {}
context = RequestContext(request)
for key, value in extra_context.items():
context[key] = callable(value) and value() or value

return render_to_response(template_name,
  { 'form': form },
  context

Form Data is not saving to database

2009-02-03 Thread Praveen

http://dpaste.com/116096/
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Form Data is not saving to database

2009-02-03 Thread Praveen

Oops... yeah Brian that i forgot to make it as a foriegn key to the
user table and that might be surprised without making foriegn key i
did not get any error even though my settings.DEBUG is true. but now i
made user field in MemberProfile but the same problem my form data is
not saving to foriegn key.

Please assume the user as foriegn key to the user table on same link

http://dpaste.com/116096/

or may see here http://dpaste.com/116432/

Thanks



On Feb 3, 9:47 pm, Brian Neal  wrote:
> On Feb 3, 6:36 am, Praveen  wrote:
>
> >http://dpaste.com/116096/
>
> The user field in your MemberProfile is a CharField (I was expecting
> it to be a ForeignKey to the User table).
>
> I think the problem is you can't assign request.user to a CharField
> (line 31). I'm surprised you don't get an error on line 34. Is
> settings.DEBUG True?
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



form is not displaying

2009-02-04 Thread Praveen

http://dpaste.com/116535/
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



form invalid

2009-02-09 Thread Praveen

hi i have one form inside the form


{% for name in eventname %}

{{ name.title }}

{{ name.address }}
{{ name.summary }}

{{ name.title }}



{{ name.summary }}
{{ name.start_date }} to {{ 
name.end_date }}
{{ name.start_time }} to {{ 
name.end_time }}
{{ name.venue }}
{{ name.contact }}
{{ name.description }}


{{ forms.name }} Friend's 
Name
{{ forms.email }} Friend's 
Email
{{ 
forms.comment}}

Submit
 



{% endfor %}


forms.py
-
class MailForm(forms.Form):
#topic = forms.ChoiceField(choices=TOPIC_CHOICES)
name  = forms.CharField(label=_("Name"), max_length=50)
email = forms.EmailField(label=_("Email address"))
comment = forms.CharField(label=_("Comment"),
widget=forms.Textarea)

eventview.py

def event(request):
difference1 = datetime.timedelta(days=-3)
today=datetime.date.today()
print "Today date : ", today
l=range(1,5)
forms = MailForm(request.POST)# Creating MAIL FORM interface in side
event template
print "Mail Form : ", forms
eventobj=events.objects.all().filter
(start_date__lte=today,end_date__gte=today)
eventname=events.objects.all().filter
(start_date__lte=today,end_date__gte=today)
#eventobj=events.objects.all().filter(start_date__gte=today-
datetime.timedelta(days=3), end_date__lte=today+datetime.timedelta
(days=10), highlighted='true',visibility='true')
paginator = Paginator(eventobj, 2)
try:
page = int(request.GET.get('page','1'))
print "page : ", page
except ValueError:
page = 1
try:
eventobj = paginator.page(page)
print " Event object : ", eventobj
except(EmptyPage, InvalidPage):
eventobj = paginator.page(paginator.num_pages)
return render_to_response("event.html",
{'eventobj':eventobj,'l':l,'eventname':eventname,'today':today.strftime
("%B %d %Y %A"),'forms':forms})

#View for send mail#
---
def mail(request):
if request.method == 'POST': # If the form has been submitted...
form = MailForm(request.POST) # A form bound to the POST data
if form.is_valid():
print "Form valid"
comment = form.cleaned_data['comment']
email = ['i...@example.com']
from django.core.mail import send_mail
send_mail(comment, email)
print "Send mail : ", send_mail(comment, email)
return HttpResponseRedirect('/pro/Thanks/')
else:
print "Invalid form"
form = MailForm() # An unbound form
return render_to_response('contact.html', {'form': form})

urls.py
--

(r'^foodies/events/$', 'foodies.foodapp.eventview.event'),
(r'^foodies/sendmail/$','foodies.foodapp.eventview.mail'),

i am displaying eventdetails in light box where i have one submit and
name and email field. if some one click on submit then mail should
send page should closed. but when i am clicking on submit button form
is closing but it shows me "Invalid Form" which i wrote in else part
of mail view. i think some thing wrong in get or post.


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



Associating content with multiple sites

2009-02-10 Thread Praveen

lets assume all in lowercase

expo/expoapp/models.py


class events(models.Model):
title = models.CharField(max_length = 50)
summary = models.CharField(max_length = 100)
description = models.CharField(max_length = 300)
event_type = models.ForeignKey(event_type)
start_date = models.DateField()
end_date = models.DateField()
contact_detail = models.CharField(max_length = 100)
booking_url = models.URLField(max_length = 50)
venue = models.CharField(max_length = 100, blank = True)
address = models.CharField(max_length = 100, blank = True)

foodie/foodieapp/models.py


class events(models.Model):
title = models.CharField(max_length = 50)
summary = models.CharField(max_length = 100)
description = models.CharField(max_length = 300)
event_type = models.ForeignKey(event_type)
start_date = models.DateField()
end_date = models.DateField()
contact_detail = models.CharField(max_length = 100)
booking_url = models.URLField(max_length = 50)
venue = models.CharField(max_length = 100, blank = True)
address = models.CharField(max_length = 100, blank = True)

we have same structure events class in both sites.
Both sites use the same events database, and an events is associated
with one or more sites
It lets the site producers edit all events -- on both sites -- in a
single interface (the Django admin).
so my doubt is:
Is it necessary to write events class in both application and if it is
not then where should i keep events class in which app. if it should
be in both sites then how may i proceed ahead?
If i keep events class in both models.py then i will face this problem
No, that would mean for app a and b you will get tables: a_eventtype
and b_eventtype.
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problems with djangosearch setup

2009-02-10 Thread Praveen

SEARCH_ENGINE is not able to find solr. i think some thing wrong in
your configuration or try to change the case SOLR 'Solr' some thing
like that

On Feb 11, 6:15 am, Shantp  wrote:
> Hi
>
> I've installed Java, Tomcat and Solr. I followed the directions and
> got pysolr as well. I put the djangosearch app on my python path and
> put it in the installed_apps in my settings.py.
>
> http://code.google.com/p/djangosearch/source/browse/branches/soc-new-...
>
> In the read me it says to put this in my settings.py file:
>
> SEARCH_ENGINE="solr"
>
> I did this and when I run a shell to do a test query I get an error
> saying "ImportError: No module named solr"
>
> Did anyone successfully setup this app? Why is it giving this error?
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How does sites framework work?

2009-02-11 Thread Praveen

http://pastebin.com/m78d7486f

http://docs.djangoproject.com/en/dev/ref/contrib/sites/ i have
reffered this link but i have doubt shall i keep Article model's class
in both site.
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Associating content with multiple sites

2009-02-11 Thread Praveen

http://pastebin.com/m78d7486f

http://docs.djangoproject.com/en/dev/ref/contrib/sites/ i have
reffered this link but i have doubt shall i keep Article model's
class
in both site.

On Feb 11, 7:37 pm, Alex Gaynor  wrote:
> On Wed, Feb 11, 2009 at 2:11 AM, Praveen 
> wrote:
>
>
>
>
>
>
>
> > lets assume all in lowercase
>
> > expo/expoapp/models.py
> > 
>
> > class events(models.Model):
> >    title = models.CharField(max_length = 50)
> >    summary = models.CharField(max_length = 100)
> >    description = models.CharField(max_length = 300)
> >    event_type = models.ForeignKey(event_type)
> >    start_date = models.DateField()
> >    end_date = models.DateField()
> >    contact_detail = models.CharField(max_length = 100)
> >    booking_url = models.URLField(max_length = 50)
> >    venue = models.CharField(max_length = 100, blank = True)
> >    address = models.CharField(max_length = 100, blank = True)
>
> > foodie/foodieapp/models.py
> > 
>
> > class events(models.Model):
> >    title = models.CharField(max_length = 50)
> >    summary = models.CharField(max_length = 100)
> >    description = models.CharField(max_length = 300)
> >    event_type = models.ForeignKey(event_type)
> >    start_date = models.DateField()
> >    end_date = models.DateField()
> >    contact_detail = models.CharField(max_length = 100)
> >    booking_url = models.URLField(max_length = 50)
> >    venue = models.CharField(max_length = 100, blank = True)
> >    address = models.CharField(max_length = 100, blank = True)
>
> > we have same structure events class in both sites.
> > Both sites use the same events database, and an events is associated
> > with one or more sites
> > It lets the site producers edit all events -- on both sites -- in a
> > single interface (the Django admin).
> > so my doubt is:
> > Is it necessary to write events class in both application and if it is
> > not then where should i keep events class in which app. if it should
> > be in both sites then how may i proceed ahead?
> > If i keep events class in both models.py then i will face this problem
> > No, that would mean for app a and b you will get tables: a_eventtype
> > and b_eventtype.
>
> Take a look at the sites 
> framework:http://docs.djangoproject.com/en/dev/ref/contrib/sites/?from=olddocs
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



sites framework

2009-02-11 Thread Praveen

we have same structure events class in both sites.
Both sites use the same events database, and an events is associated
with one or more sites
It lets the site producers edit all events -- on both sites -- in a
single interface (the Django admin).
so my doubt is:
Is it necessary to write events class in both application and if it is
not then where should i keep events class in which app. if it should
be in both sites then how may i proceed ahead? If i keep events class
in both models.py then i will face this problem No, that would mean
for app a and b you will get tables: a_eventtype and b_eventtype.


myproject
|exposite
|settings.py
|urls.py
|manage.py

|expoapp
|views.py
|models.py
|urls.py
|foodiesite
|settings.py
|urls.py
|manage.py

|foodiesapp
|views.py
|models.py
|urls.py

|eventsapp
|views.py
|models.py
|urls.py

 settings.py
 urls.py
 manage.py

exposite/settings.py
-
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.comments',
'exposite.expoapp',
)
SITE_ID = 1
ROOT_URLCONF = 'myproject.urls'

foodiesite/settings.py
--
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.admindocs',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.comments',
'foodiesite.foodapp',
'registration',
'profiles',
)
SITE_ID = 2
ROOT_URLCONF = 'myproject.urls'

TEMPLATE_DIRS = (
"/home/praveen/DJANGOPRJ/myproject/foodieapp/templates",
)

below one is my structure of site. and i try to keep apps outside the
sites and kept only(settings,urls) but do not know the further
process.

exposite/expoapp/models.py and foodiesite/foodieapp/models.py (SAME
STRUCTURE OF events CLASS IN BOTH)
   --

class events(models.Model):
title = models.CharField(max_length = 50)
summary = models.CharField(max_length = 100)
description = models.CharField(max_length = 300)
event_type = models.ForeignKey(event_type)
start_date = models.DateField()
end_date = models.DateField()
contact_detail = models.CharField(max_length = 100)
    booking_url = models.URLField(max_length = 50)
venue = models.CharField(max_length = 100, blank = True)
address = models.CharField(max_length = 100, blank = True)


TEMPLATE_DIRS = (
"/home/praveen/DJANGOPRJ/myproject/expoapp/templates",
)

so in admin interface i have 3 apps eventsapp, expoapp, and foodapp.
when i write in terminal
:~/DJANGOPRJ/myproject/exposite$/ python manage.py shell
>>from myproject.eventsapp.models import *
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: No module named myproject.eventsapp.models

because i am inside the exposite. i think we can keep the eventapp on
Django python path and may call any where. but i do not know how may i
keep..
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: blank=True on Char/TextFields

2009-02-13 Thread Praveen

Hi Toby, you have not read properly the django docs.

Note that empty string values will always get stored as empty strings,
not as NULL.

only use null=True for non-string fields such as integers, booleans
and dates.

For both types of fields, you will also need to set blank=True if you
wish to permit empty values in forms, as the null parameter only
affects database storage.

Avoid using null on string-based fields such as CharField and
TextField unless you have an excellent reason.

null is purely database-related, whereas blank is validation-related.
If a field has blank=True, validation on Django’s admin site will
allow entry of an empty value. If a field has blank=False, the field
will be required.

but in your case you want to leave the field with no string then go to
back-end and change the value NULL to 'NOT NULL' to that field.

On Feb 12, 8:35 pm, tow  wrote:
> I know this seems to be a constant source of confusion; but I seem to
> have managed to confuse myself:
>
> class TextData(models.Model):
>      text = models.TextField(blank=True)
>
> So I have a model with one textfield, whose value can be empty, and I
> don't want to worry about distinguishing NULLs and empty strings.
> perfect. So far so good according to the documentation.
>
> obj = TextData()
> obj.text = ''
> obj.save()
>
> ... works fine
>
> obj = TextData()
> obj.text = None
> obj.save()
>
> gives me an IntegrityError. Why? I don't care that whether that's
> saved as a Null or an zero-length string, I just want Django to save
> back my data according to whatever convention it's using for this
> field - the docs tell me if I do blank=True, then it'll use an empty
> string and not bother distinguishing nulls; or at least so they imply
> to me. But apparently it is trying to distinguish nulls, because it's
> given me an IntegrityError. I was expecting Django to coerce the None
> to an empty string before saving.
>
> The reason why I'm doing this is because I'm filling up a model object
> (which actually contains lots of fields), based upon a dictionary
> which might be incomplete.
>
> I really want to do something like:
>
> d = incomplete_dictionary()
> obj = MyModel()
> for k in fieldnames;
>     setattr(k, d.get(k))
>
> but I can't; that'll set missing fields to None. What I'm having to do
> instead is special-case all of the string values in order to set them
> to the empty string instead, which is rather more fragile.
>
> Toby
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



POST Method problem with profile

2009-02-18 Thread Praveen

urls.py
---

url(r'^accounts/profile/$', create_profile, { 'profile_callback':
UserProfile.objects.create },name='profiles_create_profile'),
url(r'^accounts/editprofile/$', edit_profile,
name='profiles_edit_profile'),
url(r'^accounts/viewprofile/(?P\w+)/$', profile_detail,
name='profiles_profile_detail'),

views.py


def create_profile(request, form_class=ProfileForm,
success_url=None,template_name='registration/profile.html',
   extra_context=None,profile_callback=None,):
try:
profile_obj = request.user.get_profile()
print "Profile obj : ", profile_obj ## Profile obj
is printing
return HttpResponseRedirect(reverse('profiles_edit_profile'))
except ObjectDoesNotExist:
pass

if success_url is None:
success_url = reverse('profiles_profile_detail',
  kwargs={ 'username':
request.user.username })
if form_class is None:
form_class = utils.get_profile_form()

if request.method == 'POST':
form = form_class(data=request.POST, files=request.FILES)
if form.is_valid():
profile_obj = form.save(request.user)
#profile_obj.user = request.user
#profile_obj.save()
if hasattr(form, 'save_m2m'):
form.save_m2m()
return HttpResponseRedirect(success_url)
else:
form = form_class()

if extra_context is None:
extra_context = {}
context = RequestContext(request)
for key, value in extra_context.items():
context[key] = callable(value) and value() or value

return render_to_response(template_name,
  { 'form': form },
  context_instance=context)
create_profile = login_required(create_profile)

  Edit Profile view ##
def edit_profile(request, form_class=None, success_url=None,
 template_name='registration/edit_profile.html',
 extra_context=None):
try:
profile_obj = request.user.get_profile()
print "edit profile_obj :", profile_obj
except ObjectDoesNotExist:
return HttpResponseRedirect(reverse
('profiles_create_profile'))

if success_url is None:
success_url = reverse('profiles_profile_detail',
  kwargs={ 'username':
request.user.username })
if form_class is None:
form_class = utils.get_profile_form()
if request.method == 'POST':
form = form_class(data=request.POST, files=request.FILES,
instance=profile_obj)
print "Form ; ", form
if form.is_valid():
form.save()
return HttpResponseRedirect(success_url)
else:
form = form_class(instance=profile_obj)

if extra_context is None:
extra_context = {}
context = RequestContext(request)
for key, value in extra_context.items():
context[key] = callable(value) and value() or value

return render_to_response(template_name,
  { 'form': form,
'profile': profile_obj, },
  context_instance=context)
edit_profile = login_required(edit_profile)


#  detail view of profile ##

def profile_detail(request, username, public_profile_field=None,
   template_name='registration/profile_list.html',
   extra_context=None):

user = get_object_or_404(User, username=username)
try:
profile_obj = user.get_profile()
profile_model = utils.get_profile_model()
print "Profile Model :", profile_obj
except ObjectDoesNotExist:
raise Http404
if public_profile_field is not None and \
   not getattr(profile_obj, public_profile_field):
profile_obj = None

if extra_context is None:
extra_context = {}
context = RequestContext(request)
for key, value in extra_context.items():
context[key] = callable(value) and value() or value

return render_to_response(template_name,
  { 'profile_obj': profile_obj },
  context_instance=context)

profile.html




edit_profile.html
-



profile_list.html

 this
work but do not save altered value to database and i tried with this
too
 i get
errors " this field is required"


Very first time if user have not created profile then account/profile
will redirect you to profile.html and will let you to save the
profile. if the user come back or write in browser accounts/profile
then it will redirect you to accounts/editprofile(user have already
profile) with edit_profile.html and all fields display the same value
as he enetered first time while creating the profile now suppose he
change the gender Male to Female and save profile then it takes you to
view profile but in view profile i still get gender female(because
that form is GET met

Re: Registration Behavior

2009-02-18 Thread Praveen

Hi could you please tell me more about sorry i could not get you. are
you using django-profiles?

On Feb 19, 8:24 am, timlash  wrote:
> I'm running Python 2.4, Django 1.0.2 and Django_Registration-0.7 on my
> Debian Etch box.  I'm making decent progress on developing my first
> Django web app.  I've got models, tables, views, templates,
> registration has successfully sent Gmail and test users have been
> activated.
>
> My first noob problem: I don't understand how Django and/or
> Registration is controlling the order in which web pages are
> requested.  After logging in a test user on the development server at:
>
>                http://localhost:8000/mysite/accounts/login/
>
> the following page is requested:
>
>                http://localhost:8000/accounts/profile/
>
> Obviously, this throws an error since urls.py only includes references
> to mysite.  This line is also inurls.py:
>
>                 (r'^mysite/accounts/', include('registration.urls')),
>
> I've searched the Django doc and poked through all the registration
> files but I can't find any instructions that tell the web server to go
> (upon successful login) from .../login/ to .../profile/
>
> Any pointers would be greatly appreciated.
>
> Cheers,
>
> Tim
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django Certifications

2009-03-05 Thread Praveen

Is there any Django certification as others like SCJP, MCSE, CCNA and
more on?
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Database error in Django

2009-04-03 Thread Praveen

def queryset(self, request):
qs = super(EventAdmin, self).queryset(request)
if not request.user.is_superuser:
qs = qs.filter(city=request.user.get_profile().res_city)
return qs

it works fine as but it list out all the city's events

def queryset(self, request):
qs = super(EventAdmin, self).queryset(request)
if request.user.is_superuser:
qs = qs.filter(city=request.user.get_profile().res_city)
return qs

but when i change the if condition it gives error message

Database error

Something's wrong with your database installation. Make sure the
appropriate database tables have been created, and make sure the
database is readable by the appropriate user.


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



registration and profile must save at a time

2009-04-08 Thread Praveen

hi all i have one very intrested question when we write /accounts/
register/ then on browser i get 5 field
username,pwd,cnfpwd,firstname,lastname
but i want to add two more fields city, age on registration form.
i know i can use django-profiles to extend User and can save to
UserProfile
but i am not worried let the city, age save to UserProfile table.
i want the user should feel he is registering with site but mechanism
is we are saving registration and profile at a time.
if i write on browser
/accounts/register

User Name : TextField
First Name : TextField
Last Name : TextField
Password   : TextField
Confirm  : TextField
City: TextField
Age: DropDown

Click on Register
last two field is saving to UserProfile table and remain are saving to
auth_user.
in settings.py AUTH_PROFILE_MODULE = app_label.UserProfile
i am very much familiar with django-registration and django-profile
but it really wiered to display extra fields on Registration Form for
that we will have to customize the from django.contrib.auth.forms.

thanks

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



Re: registration and profile must save at a time

2009-04-08 Thread Praveen

Thank you so much Malcolm but to display extra fields on sign up we
will have to customize the django.contric.auth.forms then that form is
generated from the user models i am so much confused whether i will
have to add extra field in user model class or not but i do not want
change the structure of auth_user table. ok in a single line i want
django-registration and django-profile to be mingle in one form. could
you please suggest me link or idea.

On Apr 8, 5:36 pm, Praveen  wrote:
> hi all i have one very intrested question when we write /accounts/
> register/ then on browser i get 5 field
> username,pwd,cnfpwd,firstname,lastname
> but i want to add two more fields city, age on registration form.
> i know i can use django-profiles to extend User and can save to
> UserProfile
> but i am not worried let the city, age save to UserProfile table.
> i want the user should feel he is registering with site but mechanism
> is we are saving registration and profile at a time.
> if i write on browser
> /accounts/register
>
> User Name : TextField
> First Name : TextField
> Last Name : TextField
> Password   : TextField
> Confirm      : TextField
> City            : TextField
> Age            : DropDown
>
> Click on Register
> last two field is saving to UserProfile table and remain are saving to
> auth_user.
> in settings.py AUTH_PROFILE_MODULE = app_label.UserProfile
> i am very much familiar with django-registration and django-profile
> but it really wiered to display extra fields on Registration Form for
> that we will have to customize the from django.contrib.auth.forms.
>
> thanks
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: registration and profile must save at a time

2009-04-10 Thread Praveen

Thanks and i tried to do in same fashion as Bennett suggested
but getting errror

def register_handle_form(request, redirect=None):

print "I am in handle form"
form_class = utils.get_profile_form()
if request.method == 'POST':
print "i am in profile post"
profileform = form_class(data=request.POST,
files=request.FILES)
form = RegistrationForm(request.POST)
if form.is_valid():
contact = form.save(request)
profile_obj = profileform.save(commit=False)
profile_obj.user = request.user
profile_obj.save()
if not redirect:
redirect = urlresolvers.reverse
('registration_complete')
return (True, http.HttpResponseRedirect
(urlresolvers.reverse('registration_complete')))
#return HttpResponseRedirect(reverse
('registration_complete'))

else:
initial_data = {}
try:
contact = Contact.objects.from_request(request,
create=False)
initial_data = {
'email': contact.email,
'first_name': contact.first_name,
'last_name': contact.last_name }
except Contact.DoesNotExist:
log.debug("No contact in request")
contact = None

signals.satchmo_registration_initialdata.send(contact,
contact=contact,
initial_data=initial_data)

form = RegistrationForm(initial=initial_data)
profileform = form_class(data=request.POST,
files=request.FILES)
return (False, form, profileform)



def activate(request, activation_key):
from registration.models import RegistrationProfile
activation_key = activation_key.lower()
account = RegistrationProfile.objects.activate_user
(activation_key)

if account:
# ** hack for logging in the user **
# when the login form is posted, user = authenticate
(username=data['username'], password=data['password'])
# ...but we cannot authenticate without password... so we work-
around authentication
account.backend = settings.AUTHENTICATION_BACKENDS[0]
login(request, account)
contact = Contact.objects.get(user=account)
request.session[CUSTOMER_ID] = contact.id
send_welcome_email(contact.email, contact.first_name,
contact.last_name)
signals.satchmo_registration_verified.send(contact,
contact=contact)

context = RequestContext(request, {
'account': account,
'expiration_days': config_value('SHOP',
'ACCOUNT_ACTIVATION_DAYS'),
})
return render_to_response('registration/activate.html', context)


def register(request, redirect=None, template='registration/
registration_form.html'):
"""
Allows a new user to register an account.
"""
print " I am in my register"
ret = register_handle_form(request, redirect)
#ret = register_handle_profile_form(request, redirect)
#form_class = utils.get_profile_form()
#pform = form_class(data=request.POST, files=request.FILES)
print "Ret length :", len(ret)
print "Ret :", ret
#print "Pet :", pform
success = ret[0]
todo = ret[1]
profiledo = ret[2]
#print "Profile object :", profiledo
if len(ret) > 2:
extra_context = ret[2]
#print "If extra context", extra_context
else:
extra_context = {}
#print "Else extra context", extra_context

if success:
return "Successfull"
else:
if config_get_group('NEWSLETTER'):
show_newsletter = True
else:
show_newsletter = False

ctx = {
'form': todo,
'pform': profiledo,
'title' : _('Registration Form'),
'show_newsletter' : show_newsletter
}
print "CTX :", ctx
#if extra_context:
 #   ctx.update(extra_context)

context = RequestContext(request, ctx)
return render_to_response(template, context)

ERROR:
tuple index out of range

profiledo = ret[2]  //in this line
when i go to accounts/register/ at first time and tried to print the
ret
Ret : (False, , ) it
returns me a tuple with 3 elements after clicking on register button
it return me tuple with 2 elements.


On Apr 9, 11:50 am, James Bennett  wrote:
> On Thu, Apr 9, 2009 at 12:27 AM, Praveen  
> wrote:
> > Thank you so much Malcolm but to display extra fields on sign up we
> > will have to customize the django.contric.auth.forms then that form is
> > generated from the user models i am so much confused whether i will
> > have to add extra field in user mod

Registration form and Profile form is not saving

2009-04-11 Thread Praveen

Hi all, i am really fed up and have tried number of way. Please read
my last line which really describe where i am facing problem.
First Attempt.
models.py
-
class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True, verbose_name=_
('user'))
gender = models.CharField(_('gender'), max_length=1,
choices=GENDER_CHOICES, blank=True)
dob = models.DateField(_('dob'), max_length=10, help_text=_
("Should be in date format"), null=True, blank=True)
city = models.CharField(_('res_city'), max_length=30,
choices=CITY_CHOICES, blank=True)

class RegistrationForm(forms.Form):
"""The basic account registration form."""
title = forms.CharField(max_length=30, label=_('Title'),
required=False)
email = forms.EmailField(label=_('Email address'),
max_length=75, required=True)
password2 = forms.CharField(label=_('Password (again)'),
max_length=30, widget=forms.PasswordInput(), required=True)
password1 = forms.CharField(label=_('Password'),
max_length=30, widget=forms.PasswordInput(), required=True)
first_name = forms.CharField(label=_('First name'),
max_length=30, required=True)
last_name = forms.CharField(label=_('Last name'),
max_length=30, required=True)
#gender = forms.CharField(label = _('Gender'), widget =
forms.Select(choices=GENDER_CHOICES,attrs=attrs_dict))
#dob = forms.DateTimeField(widget=forms.DateTimeInput(attrs=dict
(attrs_dict, max_length=75)), label=_(u'date of birth'))
#city = forms.CharField(label = _('res_city'), widget =
forms.Select(choices=CITY_CHOICES,attrs=attrs_dict))

def __init__(self, *args, **kwargs):
self.contact = None
super(RegistrationForm, self).__init__(*args, **kwargs)

newsletter = forms.BooleanField(label=_('Newsletter'),
widget=forms.CheckboxInput(), required=False)

def clean_password1(self):
"""Enforce that password and password2 are the same."""
p1 = self.cleaned_data.get('password1')
p2 = self.cleaned_data.get('password2')
if not (p1 and p2 and p1 == p2):
raise forms.ValidationError(
ugettext("The two passwords do not match."))

# note, here is where we'd put some kind of custom
# validator to enforce "hard" passwords.
return p1

def clean_email(self):
"""Prevent account hijacking by disallowing duplicate
emails."""
email = self.cleaned_data.get('email', None)
if email and User.objects.filter(email=email).count() > 0:
raise forms.ValidationError(
ugettext("That email address is already in use."))

return email

def save(self, request=None, **kwargs):
"""Create the contact and user described on the form.  Returns
the
`contact`.
"""
if self.contact:
log.debug('skipping save, already done')
else:
self.save_contact(request)
return self.contact

def save_contact(self, request):
print " i am in save_contact "
log.debug("Saving contact")
data = self.cleaned_data
password = data['password1']
email = data['email']
first_name = data['first_name']
last_name = data['last_name']
username = data['title']
#dob = data['dob']
#gender = data['gender']
#city = data['city']

verify = (config_value('SHOP', 'ACCOUNT_VERIFICATION') ==
'EMAIL')

if verify:
from registration.models import RegistrationProfile
user = RegistrationProfile.objects.create_inactive_user(
username, password, email, send_email=True)
else:
user = User.objects.create_user(username, email, password)

user.first_name = first_name
user.last_name = last_name
user.save()

# If the user already has a contact, retrieve it.
# Otherwise, create a new one.
try:
contact = Contact.objects.from_request(request,
create=False)
#profile = UserProfile.objects.form_request(request,
create=False)
except Contact.DoesNotExist:
contact = Contact()

contact.user = user
contact.first_name = first_name
contact.last_name = last_name
contact.email = email
contact.role = 'Customer'
contact.title = data.get('title', '')
contact.save()

if 'newsletter' not in data:
subscribed = False
else:
subscribed = data['newsletter']

signals.satchmo_registration.send(self, contact=contact,
subscribed=subscribed, data=data)

def save_profile(self, request):
user_obj = User.objects.get(pk=request.user.id)
#user_obj.first_name = self.cleaned_data['first_name']
#user_obj.last_name = self.cleaned_data['last_name']
try:
profile_obj = request.user.get_profile()
excep

Re: Registration form and Profile form is not saving

2009-04-12 Thread Praveen

How the current user logging-in first while registration.. you mean to
say after successfully registration the user must login automatically.

On Apr 11, 7:55 pm, Praveen  wrote:
> Hi all, i am really fed up and have tried number of way. Please read
> my last line which really describe where i am facing problem.
> First Attempt.
> models.py
> -
> class UserProfile(models.Model):
>     user = models.ForeignKey(User, unique=True, verbose_name=_
> ('user'))
>     gender = models.CharField(_('gender'), max_length=1,
> choices=GENDER_CHOICES, blank=True)
>     dob = models.DateField(_('dob'), max_length=10, help_text=_
> ("Should be in date format"), null=True, blank=True)
>     city = models.CharField(_('res_city'), max_length=30,
> choices=CITY_CHOICES, blank=True)
>
> class RegistrationForm(forms.Form):
>     """The basic account registration form."""
>     title = forms.CharField(max_length=30, label=_('Title'),
> required=False)
>     email = forms.EmailField(label=_('Email address'),
>         max_length=75, required=True)
>     password2 = forms.CharField(label=_('Password (again)'),
>         max_length=30, widget=forms.PasswordInput(), required=True)
>     password1 = forms.CharField(label=_('Password'),
>         max_length=30, widget=forms.PasswordInput(), required=True)
>     first_name = forms.CharField(label=_('First name'),
>         max_length=30, required=True)
>     last_name = forms.CharField(label=_('Last name'),
>         max_length=30, required=True)
>     #gender = forms.CharField(label = _('Gender'), widget =
> forms.Select(choices=GENDER_CHOICES,attrs=attrs_dict))
>     #dob = forms.DateTimeField(widget=forms.DateTimeInput(attrs=dict
> (attrs_dict, max_length=75)), label=_(u'date of birth'))
>     #city = forms.CharField(label = _('res_city'), widget =
> forms.Select(choices=CITY_CHOICES,attrs=attrs_dict))
>
>     def __init__(self, *args, **kwargs):
>         self.contact = None
>         super(RegistrationForm, self).__init__(*args, **kwargs)
>
>     newsletter = forms.BooleanField(label=_('Newsletter'),
>         widget=forms.CheckboxInput(), required=False)
>
>     def clean_password1(self):
>         """Enforce that password and password2 are the same."""
>         p1 = self.cleaned_data.get('password1')
>         p2 = self.cleaned_data.get('password2')
>         if not (p1 and p2 and p1 == p2):
>             raise forms.ValidationError(
>                 ugettext("The two passwords do not match."))
>
>         # note, here is where we'd put some kind of custom
>         # validator to enforce "hard" passwords.
>         return p1
>
>     def clean_email(self):
>         """Prevent account hijacking by disallowing duplicate
> emails."""
>         email = self.cleaned_data.get('email', None)
>         if email and User.objects.filter(email=email).count() > 0:
>             raise forms.ValidationError(
>                 ugettext("That email address is already in use."))
>
>         return email
>
>     def save(self, request=None, **kwargs):
>         """Create the contact and user described on the form.  Returns
> the
>         `contact`.
>         """
>         if self.contact:
>             log.debug('skipping save, already done')
>         else:
>             self.save_contact(request)
>         return self.contact
>
>     def save_contact(self, request):
>         print " i am in save_contact "
>         log.debug("Saving contact")
>         data = self.cleaned_data
>         password = data['password1']
>         email = data['email']
>         first_name = data['first_name']
>         last_name = data['last_name']
>         username = data['title']
>         #dob = data['dob']
>         #gender = data['gender']
>         #city = data['city']
>
>         verify = (config_value('SHOP', 'ACCOUNT_VERIFICATION') ==
> 'EMAIL')
>
>         if verify:
>             from registration.models import RegistrationProfile
>             user = RegistrationProfile.objects.create_inactive_user(
>                 username, password, email, send_email=True)
>         else:
>             user = User.objects.create_user(username, email, password)
>
>         user.first_name = first_name
>         user.las

Re: newbie question: django-registration

2009-04-12 Thread Praveen

You should change the site domain name example.com to 127.0.0.1:8000
check in your django-site table.. http://www.example.com/accounts/activate/
637cd08106eea9b1139efd34a0fa79a5d7f90494/  for instance
http://127.0.0.1:8000/accounts/activate/
637cd08106eea9b1139efd34a0fa79a5d7f90494/

On Apr 13, 12:55 am, Angel Cruz  wrote:
> Eh,
> Never mind.  Something is wrong with my root url (fixing the link from the
> email activated the account).
>
> I will fix it.
>
> On Sun, Apr 12, 2009 at 12:21 PM, MrBodjangles wrote:
>
> > Hi Folks and Happy Easter!
>
> > OK, making slow but sure progress on learning Django.
>
> > I am using django-registration, have provided the simple templates
> > required, and am to the point that a user can register (their usename,
> > password, etc. get populated in the auth_user table of the PostgreSQL
> > databae I am using), and receives an email.
>
> > I am stuck on the activation.
>
> > When I check my email and click on the link, I receive the following:
> > "The requested URL /accounts/activate/
> > 637cd08106eea9b1139efd34a0fa79a5d7f90494/ was not found on this
> > server"
>
> > I had assumed that the /accounts/activate/ folder
> > would have been automatically generated?
>
> > I added this line to my URLConf, thinking this was the reason:
> >    (r'^accounts/activate//
> > $','registration.views.activate'),
>
> > What step am I missing?
>
> > Advanced Thanks!
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to use email instead of username for user authentication?

2009-04-12 Thread Praveen

You please check the satchmo package there they are using email as
username in satchmo-registration using
user=generate_id(email,firstname)

On Apr 13, 9:44 am, pkenjora  wrote:
> Malcolm,  <- Remembered the 'l' this time!
>
> To keep things simple and avoid fragmenting this discussion into a
> million different dead end tit for tats , I'll try to reign in the
> main points.
>
> 1. The default authentication method in Django should have no inherent
> restrictions.  Such as blocking '@' in the username.  This leaves the
> default framework open and free of workarounds.  This approach would
> not preclude any project specific requirements.
>
> 2. Any authentication method having restrictions should be an opt in
> method.  The current method is a restrictive authentication method,
> one that does not allow email, and should be made optional.
>
> 3. When you boil down the hundreds of specific use cases out there you
> still end up with the above two points.  In which case I would make
> the argument that if you need to block emails as user names then it is
> you who should write a new authentication handler.  In your own words,
> the framework allows this and its only a few lines of code.
>
> Now for the dead end tit for tat... this is really project philosophy
> not framework philosophy... hence I feel like it is circular
> discussion that distracts from the main point...
>
> Authenticating by email does not require me to check my email every
> time I log in.  So if my email is no longer accessible (left my job) I
> can simply log in and change it to a new one.  If changing the
> username requires checking my email then I will have the same problem
> if I use email as my username or not.
>
> You yourself identify the username as mainly an authentication
> mechanism not necessarily a display value.  Thats all the more reason
> to have a robust restriction free out of the box implementation of
> authentication.
>
> Thanks for reading the feedback, I still fail to see how you can
> include project specific requirements in a framework? The
> implementation you are advocating is a subset of the general
> implementation I would like to see bundled out of the box.  Why not
> move it into an optional module?
>
> -Paul
>
> On Apr 11, 4:13 pm, Malcolm Tredinnick 
> wrote:
>
> > On Sat, 2009-04-11 at 07:52 -0700, pkenjora wrote:
> > > Malcom,
>
> > Well, I'm not "Malcom" (sic), but I'll reply anyway.
>
> > >    Google, FaceBook, and LinkedIn have been using email authentication
> > > for how long now?  With the default constraints you've put on Django a
> > > developer would have to "work around" the out of the box code to make
> > > the project behave like the big 3 names on the web.
>
> > There's some assumption there that what they're doing is a good idea.
> > Their systems have the usability problems I've mentioned. It's also not
> > clear their authentication methods are the best around. In any case, as
> > I note below (and have written elsewhere), you're simply not restricted
> > from using this system and can do so without patching Django, if that's
> > the way you want to go. There's no restriction in place here!
>
> > The combined size of forums and social networking sites not pretending
> > that my "handle" is an email address is, I'll wager, larger than
> > Facebook or LinkedIn, certainly. Which has precisely the same small
> > weight as your examples. The point being that there are valid use-cases
> > in both directions and you'll notice that that's never been disputed.
>
> > [...]
>
> > >   As far as your reasons go, I'm fairly sure its just as easy to
> > > change the email as it is the username,
>
> > I'm sorry you feel that way. It's patently false. The username is only
> > used on the site you are creating an account for. Your email address has
> > much wider usage and creating a new one isn't always possible or
> > desirable (signing up to one of the hosted services requires agreeing to
> > T&C that are often unpleasant). The username when creating a new account
> > on a site has much less currency.
>
> > > I would even argue that my
> > > username (display name) could change but my login credentials should
> > > stay the same.
>
> > You are assuming that the username is the display name. That might be a
> > secondary use for it and it sometimes works well for that. However, the
> > username is primarily the unique identifier for the user within the
> > system. It's the thing that won't change. Having a display name,
> > particularly one that can change is also quite common and it's for
> > extensions like that that user profile exist for.
>
> > Login credentials are not the same as identifier within the system. The
> > login credentials should definitely be permitted to change. Having an
> > account tied to an email address is tragic when that email address is no
> > longer accessible to you (for example, it was a company address and
> > you've since left the company). Allowing the email address to 

{{perms}} is not displaying on template

2009-04-17 Thread Praveen

def myfunc(request, event_id):
context_instance=RequestContext(request)
print "Context", context_instance ### Context: [{'perms':
,
'messages': [], 'user': }, {}]
return render_to_response('test.html',
{'user':request.user},context_instance=RequestContext(request))


in test.html


Permission : {{perms}}

run on browser :
---
Permission : (blank nothing is displayin)
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: {{perms}} is not displaying on template

2009-04-17 Thread Praveen

I solved my problem. i was calling wrong template.

On Apr 17, 6:09 pm, Praveen  wrote:
> def myfunc(request, event_id):
>         context_instance=RequestContext(request)
>         print "Context", context_instance ### Context: [{'perms':
> ,
> 'messages': [], 'user': }, {}]
>         return render_to_response('test.html',
> {'user':request.user},context_instance=RequestContext(request))
>
> in test.html
> 
>
> Permission : {{perms}}
>
> run on browser :
> ---
> Permission : (blank nothing is displayin)
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Registration

2009-04-20 Thread Praveen



Before going to answer of your question i am really sure that you have
not read the docs of django-registration and django docs any
way

if you want to make it use django-registration(default) then install
it and write in settings.py 'registration'(below of your appname)
in your site url

 (r'^accounts/', include('registration.urls')),

now you need to create registration_form.html (you go to in
registration packages and see all the views they have mentioned there
required html page)

create a folder named 'registration' and put your
'registration_form.html' inside that.

first create a simple template with only plain html
and write their User name : {{form.user}}
Password : {{form.password1}}

On Apr 20, 4:28 pm, TP  wrote:
> Thanks for the continued help.
>
> I have written the URLS.py now they are as below:
>
> urlpatterns = patterns('',
>                        # Activation keys get matched by \w+ instead of
> the more specific
>                        # [a-fA-F0-9]{40} because a bad activation key
> should still get to the view;
>                        # that way it can return a sensible "invalid
> key" message instead of a
>                        # confusing 404.
>                        url(r'^activate/(?P\w+)/$',
>                            activate,
>                            name='registration_activate'),
>                        url(r'^login/$',
>                            auth_views.login,
>                            {'template_name': 'registration/
> login.html'},
>                            name='auth_login'),
>                        url(r'^logout/$',
>                            auth_views.logout,
>                            {'template_name': 'registration/
> logout.html'},
>                            name='auth_logout'),
>                        url(r'^password/change/$',
>                            auth_views.password_change,
>                            name='auth_password_change'),
>                        url(r'^password/change/done/$',
>                            auth_views.password_change_done,
>                            name='auth_password_change_done'),
>                        url(r'^password/reset/$',
>                            auth_views.password_reset,
>                            name='auth_password_reset'),
>                        url(r'^password/reset/confirm/(?P[0-9A-
> Za-z]+)-(?P.+)/$',
>                            auth_views.password_reset_confirm,
>                            name='auth_password_reset_confirm'),
>                        url(r'^password/reset/complete/$',
>                            auth_views.password_reset_complete,
>                            name='auth_password_reset_complete'),
>                        url(r'^password/reset/done/$',
>                            auth_views.password_reset_done,
>                            name='auth_password_reset_done'),
>                        url(r'^register/$',
>                            register,
>                            name='registration_register'),
>                        url(r'^register/complete/$',
>                            direct_to_template,
>                            {'template': 'registration/
> registration_complete.html'},
>                            name='registration_complete'),
>                        )
>
> I think that is correct.
>
> When I load the HTML page I still cannot see a form and only see:
>
> {% load i18n %}
> {% block header %} {% trans "Home" %} | {% if user.is_authenticated %}
> {% trans "Logged in" %}: {{ user.username }} ({% trans "Log out" %} |
> {% trans "Change password" %}) {% else %} {% trans "Log in" %} {%
> endif %} {% endblock %}
> {% block content %}{% endblock %}
> {% block footer %} {% endblock %}
>
> I think I am quite close to getting this working, just having a hard
> time with linking the HTML.
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to disable deletion af a model instance

2009-05-10 Thread Praveen

Hi, i do not know how its going to achieve but in my case.
For each payment entry i will add delete button and will disable the
default django admin interface.
Create a separate GroupProfile class
class GroupProfile(models.Model):
name = models.CharField(_('name'), max_length=80, unique=True)
group = models.ManyToManyField(Group, verbose_name=_('group'),
blank=True)
city = models.ForeignKey(city)
user = models.ManyToManyField(User)

class Meta:
verbose_name = _('group')
verbose_name_plural = _('groups')

def __unicode__(self):
return self.name

Create a group for instance do_delete and assign the permission to
delete the entry.
Now create an entry for GroupProfile for instance do_delete_group and
assign the user and do_delete to this group.

in payment view you can write this code

tc = GroupProfile.objects.all().filter(user=use)
gd= {}
for obj in tc:
n = obj.group.all()
for o in n:
 gd[o.name]=o.name
value = gd.values()
render the value to the template and check if the value exist then
show the delete button otherwise do not delete.
Thanks

On May 10, 7:15 am, Margie  wrote:
> I thought that might be the case.  Is that true of the deletes done by
> a formset save as well?  IE, when a formset.save() is done, in some
> cases my delete will be called, and in some cases not?
>
> Margie
>
> On May 9, 4:57 pm, James Bennett  wrote:
>
> > On Sat, May 9, 2009 at 7:49 PM, George Song  wrote:
> > > I think if you want to know definitively if your `delete()` method is
> > > being called or not, your debug statement should go in that method. I
> > > wouldn't be surprised if Django is sending pre and post delete signals
> > > even during bulk deletion.
>
> > It's kind of tricky, really, because there's not any guarantee one way
> > or another -- QuerySet.delete() *may* call delete() methods of
> > individual objects, or it may not. IIRC it mostly comes down to how
> > much of the deletion can be done in a bulk SQL DELETE statement, and
> > how much (due to, e.g., relationships involved) requires fetching the
> > individual objects and deleting them one at a time.
>
> > --
> > "Bureaucrat Conrad, you are technically correct -- the best kind of 
> > correct."
--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: VariableDoesNotExist when I go to login page

2010-05-29 Thread Praveen
Error describes well. your request key is not exist while rendering.
are you rendering your 'request' variable to page. and what is the
request here.
Thanks
Praveen

On May 29, 5:37 pm, Victor Fontes  wrote:
> I get an error in this line:
>
>  class="first">Inicio
>
> Everyting was working just fine and all of a sudden I started to get
> this error:
>
> http://dpaste.com/200702/

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Get pk before commit

2010-05-29 Thread Praveen
Did you really mean for commit=FALSE or pre_save signal???
Praveen

On May 29, 5:22 pm, Euan Goddard 
wrote:
> Hi,
>
> Could you explain the situation in a little more detail as I don't
> quite follow what you mean. As far as I'm aware if you have something
> like the following:
>
> >>> my_inst = MyModel(foo="bar", ...)
> >>> my_inst.save()
>
> You'll have the pk at this point even if the transaction hasn't been
> committed (providing you haven't specified a custom primary key
> field). So you should be able to do:
>
> >>> my_pk = my_inst.pk
>
> and use this for the other field that you need to set. If the other
> field is a foreign key to my_inst, then you should just be able to do:
>
> >>> other_model_inst.related_object = my_inst
> >>> other_model_inst.save()
>
> I'm not sure how this is affected by transactions. Unless you have a
> really good reason to, I'd let Django handle the transaction
> management for you, then you don't need to worry about save points,
> committing and rolling back.
>
> Euan
>
> On 29 May, 07:56, TheIvIaxx  wrote:
>
> > Hello, I am trying to figure out how to get a pk in the middle of a
> > transaction. I need to set a field in the model based on the
> > ID(default pk) to be given.  As far as a i know, this ID should be
> > allocated during the transaction.  So i would imagine it would do the
> > INSERT, then i could get the pk and do what i need to do, then proceed
> > with the commit.
>
> > Is this possible?
>
> > Thanks

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-registration custom fields

2010-05-29 Thread Praveen
Hi Pankaj
here you may refer my blog where i explain how you may extend some
fields while registration.

http://praveensunsetpoint.wordpress.com/category/django/django-registration-profile/

Praveen

On May 29, 4:41 pm, Pankaj Singh 
wrote:
> I tried extending RegistrationFormUniqueEmail
>
> class CustomRegistrationFormUniqueEmail(RegistrationFormUniqueEmail):
>     first_name = forms.CharField(label=_('First name'),
> max_length=30,required=True)
>     last_name = forms.CharField(label=_('Last name'), max_length=30,
> required=True)
>     def save(self, profile_callback=None):
>         new_user = super(CustomRegistrationFormUniqueEmail,
> self).save(profile_callback=profile_callback)
>         new_user.first_name = self.cleaned_data['first_name']
>         new_user.last_name = self.cleaned_data['last_name']
>         return new_user
>
> then changing view
>
> #       form = form_class(data=request.POST, files=request.FILES)
>         form = CustomRegistrationFormUniqueEmail(data=request.POST,
> files=request.FILES)
>
> but still I am seeing default view containg four fields only ..
>
> help is needed

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Enter a valid value while saving fullname during registration

2010-01-16 Thread Praveen
   urls.py

   url(r'^accounts/register/$',register,
{'form_class':RegForm},name='registration_register'),

  form.py
  ---
  from registration.forms import *
  class RegForm(RegistrationForm):
  """
  """
  fullname = forms.RegexField(regex=r'^\w+$',
  max_length=30,
  widget=forms.TextInput
(attrs=attrs_dict),
  label=_(u'fullname'))
  def clean_fullname(self):
  "This function is required to overwrite an inherited
username clean"
  return self.cleaned_data['fullname']'''

 def clean(self):
if not self.errors:
  self.cleaned_data['first_name'] = '%s%s' %
(self.cleaned_data['fullname'].split(' ',1)[0])
  self.cleaned_data['last_name'] = '%s%s' %
(self.cleaned_data['fullname'].split(' ',1)[1])
  super(RegForm, self).clean()
  return self.cleaned_data'''
  views.py
  
  def register(request, success_url=None,
   form_class=RegForm, profile_callback=None,
   template_name='registration/
registration_form.html',
   extra_context=None):
  #pform_class = utils.get_profile_form()
  if request.method == 'POST':
  #profileform = pform_class(data=request.POST,
files=request.FILES)
  form = form_class(data=request.POST,
files=request.FILES)
  if form.is_valid():
  new_user = form.save
(profile_callback=profile_callback)
  #profile_obj = profileform.save(commit=False)
  #profile_obj.user = new_user
  #profile_obj.save()
  return HttpResponseRedirect(success_url or reverse
('registration_complete'))
  else:
  form = form_class()
  #profileform = pform_class()
  if extra_context is None:
  extra_context = {}
  context = RequestContext(request)
  for key, value in extra_context.items():
  context[key] = callable(value) and value() or value
  return render_to_response(template_name,
{ 'form': form},
context_instance=context)

  registration_form.html
  --
  
  Full Name
  
  
  
  {{ form.fullname }}
  {% for error in form.fullname.errors
%}
  {{ error }}
  {% endfor %}
  
  User Name
  
  
  
  {{ form.username }}
  {% for error in form.username.errors
%}
  {{ error }}
  {% endfor %}
  
 Email Address
 
  
  
  {{ form.email }}
  {% for error in form.email.errors %}
  {{ error }}
  {% endfor %}

 Password
  
  
  
  {{ form.password1 }}
  {% for error in
form.password1.errors %}
  {{ error }}
  {% endfor %}

 Confirm Password
 
  
  
  {{ form.password2 }}
  {% for error in
form.password2.errors %}
  {{ error }}
  {% endfor %}
   
  While saving

  Full Name: |_|   Enter a valid value.
-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Record is not saving

2010-01-30 Thread Praveen
Hi

here is my views
def phone_register(request, success_url=None,form_class = PhoneForm,
template_name="phone/phonereg_form.html", extra_context=None):
userobj = User.objects.get(pk=request.user.id)
if request.method == 'POST':
phoneform = form_class(request.POST, instance=userobj)
if phoneform.is_valid():
phoneformobj = phoneform.save(commit=False)
phoneformobj.user = request.user
phoneformobj.mobile_key = random.randint(1000,1)
phoneformobj.save()
# route_sms(smslane, phoneformobj.phoneno, Your Activation Key
is: phoneformobj.mobile_key)
return HttpResponseRedirect(success_url or reverse
('goto_dashboard'))
else:
phoneform = form_class(instance=userobj)
if extra_context is None:
extra_context = {}
context = RequestContext(request)
for key, value in extra_context.items():
context[key] = callable(value) and value() or value
return render_to_response(template_name,
{'phoneform':phoneform},context_instance=context)
phone_register = login_required(phone_register)

Here is i have pasted the full code
http://pastebin.com/m62209f51

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Record is not saving

2010-01-30 Thread Praveen
Thanks
Actually earlier i was passing instance of Phone
phoneform = PhoneForm(request.POST,instance=Phone.objects.get
(user=request.user))
but at very first time there was no record in Phone table
that is what i was getting the sql query is not matching
so i tried with
try:
userob = Phone.objects.get(user=request.user)
except Exception,e:
userob = None
if request.method == 'POST':
phoneform = form_class(request.POST, instance=userob)

and its working fine:


On Jan 30, 9:22 pm, cootetom  wrote:
> You are created a PhoneForm but passing it an instance of User. You
> need to pass the form an instance of the model it works on.
>
> - Tom
>
> On Jan 30, 3:45 pm, Praveen  wrote:
>
> > Hi
>
> > here is my views
> > def phone_register(request, success_url=None,form_class = PhoneForm,
> >                 template_name="phone/phonereg_form.html", 
> > extra_context=None):
> >     userobj = User.objects.get(pk=request.user.id)
> >     if request.method == 'POST':
> >         phoneform = form_class(request.POST, instance=userobj)
> >         if phoneform.is_valid():
> >             phoneformobj = phoneform.save(commit=False)
> >             phoneformobj.user = request.user
> >             phoneformobj.mobile_key = random.randint(1000,1)
> >             phoneformobj.save()
> >             # route_sms(smslane, phoneformobj.phoneno, Your Activation Key
> > is: phoneformobj.mobile_key)
> >             return HttpResponseRedirect(success_url or reverse
> > ('goto_dashboard'))
> >     else:
> >         phoneform = form_class(instance=userobj)
> >     if extra_context is None:
> >         extra_context = {}
> >     context = RequestContext(request)
> >     for key, value in extra_context.items():
> >         context[key] = callable(value) and value() or value
> >     return render_to_response(template_name,
> > {'phoneform':phoneform},context_instance=context)
> > phone_register = login_required(phone_register)
>
> > Here is i have pasted the full codehttp://pastebin.com/m62209f51

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



ModelAdmin

2010-03-10 Thread Praveen
Hi
I have one form in forms.py

class EmailForm(forms.Form):
recipient = forms.CharField(max_length=14, min_length=12,
widget=forms.TextInput(attrs=require))
message = forms.CharField(max_length=140, min_length=1,
widget=forms.Textarea(attrs={'cols': 30, 'rows': 5}))

and my site url is
admin.autodiscover()
urlpatterns = patterns('',  (r'^admin/(.*)',
include(admin.site.urls)),)

now i want it to be shown on admin interface

I tried so far
First attempt

from myapps.forms import EmailForm
class EmailAdmin(admin.ModelAdmin):
 form = EmailForm
did not work Exception Value:
'DeclarativeFieldsMetaclass' object is not iterable

Second attempt
and now i followed 
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_urls
but could not get help

class EmailAdmin(admin.ModelAdmin):
def my_view(self,request):
return admin_my_view(request,self)

def get_urls(self):
urls = super(SmsAdmin, self).get_urls()
my_urls = patterns('',(r'^my_view/
$',self.admin_site.admin_view(self.my_view)))
return my_urls + urls

def admin_my_view(request, model_admin):
opts = model_admin.model._meta
admin_site = model_admin.admin_site
has_perm = request.user.has_perm(opts.app_label \
+ '.' + opts.get_change_permission())
context = {'admin_site': admin_site.name,
'title': "My Custom View",
'opts': opts,
'root_path': '/%s' % admin_site.root_path,
'app_label': opts.app_label,
'has_change_permission': has_perm}
template = 'admin/demo_app/admin_my_view.html'
return render_to_response(template,
context,context_instance=RequestContext(request))
admin.site.register(EmailForm,EmailAdmin)

and when i run server and type on browser http://localhost:8000/admin
and hit enter button

Exception Value:
'DeclarativeFieldsMetaclass' object is not iterable

and second time just after first time when i again enter then it show
me the admin page but i can't see my EmailAdmin in admin intercae..

Just help me or suggest me any link.

Thanks



-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ModelAdmin

2010-03-10 Thread Praveen


On Mar 11, 3:03 am, Beres Botond  wrote:
> You cannot directly register a form with admin, you should be
> registering models
I know i can not directly register a form but i do not have any model
for Email. i just have plain form *forms.Form*
is there any other way to register Form with admin.
Thanks
>
> from myapps.forms import MyModelForm
> from myapps.models import MyModel
>
> class MyModelAdmin(admin.ModelAdmin):
>      form = MyModelForm
>
> admin.site.register(MyModel, EmailAdmin)
>
> Also the form should be a ModelForm for that model.
>
> from django.forms import ModelForm
>
> # Create the form class.
> class MyModelForm(ModelForm):
>      class Meta:
>          model = MyModel
>
> Read the docs thoroughly, 
> especially:http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#modelformhttp://docs.djangoproject.com/en/1.1/ref/contrib/admin/#ref-contrib-a...
>
> On Mar 10, 10:28 pm, Praveen  wrote:
>
> > Hi
> > I have one form in forms.py
>
> > class EmailForm(forms.Form):
> >     recipient = forms.CharField(max_length=14, min_length=12,
> > widget=forms.TextInput(attrs=require))
> >     message = forms.CharField(max_length=140, min_length=1,
> > widget=forms.Textarea(attrs={'cols': 30, 'rows': 5}))
>
> > and my site url is
> > admin.autodiscover()
> > urlpatterns = patterns('',  (r'^admin/(.*)',
> > include(admin.site.urls)),)
>
> > now i want it to be shown on admin interface
>
> > I tried so far
> > First attempt
>
> > from myapps.forms import EmailForm
> > class EmailAdmin(admin.ModelAdmin):
> >      form = EmailForm
> > did not work Exception Value:
> > 'DeclarativeFieldsMetaclass' object is not iterable
>
> > Second attempt
> > and now i 
> > followedhttp://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contri...
> > but could not get help
>
> > class EmailAdmin(admin.ModelAdmin):
> >     def my_view(self,request):
> >         return admin_my_view(request,self)
>
> >     def get_urls(self):
> >         urls = super(SmsAdmin, self).get_urls()
> >         my_urls = patterns('',(r'^my_view/
> > $',self.admin_site.admin_view(self.my_view)))
> >         return my_urls + urls
>
> > def admin_my_view(request, model_admin):
> >     opts = model_admin.model._meta
> >     admin_site = model_admin.admin_site
> >     has_perm = request.user.has_perm(opts.app_label \
> >     + '.' + opts.get_change_permission())
> >     context = {'admin_site': admin_site.name,
> >     'title': "My Custom View",
> >     'opts': opts,
> >     'root_path': '/%s' % admin_site.root_path,
> >     'app_label': opts.app_label,
> >     'has_change_permission': has_perm}
> >     template = 'admin/demo_app/admin_my_view.html'
> >     return render_to_response(template,
> > context,context_instance=RequestContext(request))
> > admin.site.register(EmailForm,EmailAdmin)
>
> > and when i run server and type on browserhttp://localhost:8000/admin
> > and hit enter button
>
> > Exception Value:
> > 'DeclarativeFieldsMetaclass' object is not iterable
>
> > and second time just after first time when i again enter then it show
> > me the admin page but i can't see my EmailAdmin in admin intercae..
>
> > Just help me or suggest me any link.
>
> > Thanks

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ModelAdmin

2010-03-10 Thread Praveen
I know i can not directly register a form but i do not have any model
for Email. i just have plain form *forms.Form*
is there any other way to register Form with admin.
Thanks

On Mar 11, 3:03 am, Beres Botond  wrote:
> You cannot directly register a form with admin, you should be
> registering models
>
> from myapps.forms import MyModelForm
> from myapps.models import MyModel
>
> class MyModelAdmin(admin.ModelAdmin):
>      form = MyModelForm
>
> admin.site.register(MyModel, EmailAdmin)
>
> Also the form should be a ModelForm for that model.
>
> from django.forms import ModelForm
>
> # Create the form class.
> class MyModelForm(ModelForm):
>      class Meta:
>          model = MyModel
>
> Read the docs thoroughly, 
> especially:http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#modelformhttp://docs.djangoproject.com/en/1.1/ref/contrib/admin/#ref-contrib-a...
>
> On Mar 10, 10:28 pm, Praveen  wrote:
>
> > Hi
> > I have one form in forms.py
>
> > class EmailForm(forms.Form):
> >     recipient = forms.CharField(max_length=14, min_length=12,
> > widget=forms.TextInput(attrs=require))
> >     message = forms.CharField(max_length=140, min_length=1,
> > widget=forms.Textarea(attrs={'cols': 30, 'rows': 5}))
>
> > and my site url is
> > admin.autodiscover()
> > urlpatterns = patterns('',  (r'^admin/(.*)',
> > include(admin.site.urls)),)
>
> > now i want it to be shown on admin interface
>
> > I tried so far
> > First attempt
>
> > from myapps.forms import EmailForm
> > class EmailAdmin(admin.ModelAdmin):
> >      form = EmailForm
> > did not work Exception Value:
> > 'DeclarativeFieldsMetaclass' object is not iterable
>
> > Second attempt
> > and now i 
> > followedhttp://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contri...
> > but could not get help
>
> > class EmailAdmin(admin.ModelAdmin):
> >     def my_view(self,request):
> >         return admin_my_view(request,self)
>
> >     def get_urls(self):
> >         urls = super(SmsAdmin, self).get_urls()
> >         my_urls = patterns('',(r'^my_view/
> > $',self.admin_site.admin_view(self.my_view)))
> >         return my_urls + urls
>
> > def admin_my_view(request, model_admin):
> >     opts = model_admin.model._meta
> >     admin_site = model_admin.admin_site
> >     has_perm = request.user.has_perm(opts.app_label \
> >     + '.' + opts.get_change_permission())
> >     context = {'admin_site': admin_site.name,
> >     'title': "My Custom View",
> >     'opts': opts,
> >     'root_path': '/%s' % admin_site.root_path,
> >     'app_label': opts.app_label,
> >     'has_change_permission': has_perm}
> >     template = 'admin/demo_app/admin_my_view.html'
> >     return render_to_response(template,
> > context,context_instance=RequestContext(request))
> > admin.site.register(EmailForm,EmailAdmin)
>
> > and when i run server and type on browserhttp://localhost:8000/admin
> > and hit enter button
>
> > Exception Value:
> > 'DeclarativeFieldsMetaclass' object is not iterable
>
> > and second time just after first time when i again enter then it show
> > me the admin page but i can't see my EmailAdmin in admin intercae..
>
> > Just help me or suggest me any link.
>
> > Thanks

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django-registration with django-profile

2010-04-05 Thread Praveen
Here i have done
look at my blog
http://praveensunsetpoint.wordpress.com/category/django/django-registration-profile/

On Apr 5, 1:03 am, Alessandro Ronchi 
wrote:
> 2010/4/3 shacker :
>
> > Cool!  Would be nice to put your solution up on djangosnippets.org or
> > similar for the benefit of others.
>
> It's nothing new. I've copied the default backend for
> django-registration, changed the RegistrationForm and handled
> correctly the form with a view.
> It's simply a matter of choice what pieces are useful to achieve the
> needed registration workflow.
>
> I found that django-profile was unuseful, because it add another
> registration step with a form you can include in registration.
>
> --
> Alessandro Ronchi
>
> http://www.soasi.com
> SOASI - Sviluppo Software e Sistemi Open Source
>
> Hobby & Giochi, l'e-commerce del 
> divertimentohttp://hobbygiochi.comhttp://www.facebook.com/pages/Forli/Hobby-Giochi/185311523755

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to find the file / directory which is hidden?

2010-04-12 Thread Praveen
There is not a big deal.
If you want to find the hiddend file on windos there is one command
attrib -h
for more info look at http://commandwindows.com/command2.htm and find
for "Changing file attributes with "attrib" "
for unix http://www.faqs.org/docs/securing/chap5sec62.html
you need to write and script to run these commands.
I just give you small example

import command
command.getoutput('ls')

which will list you all the dir(s) and file(s).
regards
Praveen

On Apr 12, 5:47 pm, Pradnya  wrote:
> Hello,
>
> I am using Django with Python on windows. I want to list the files
> from specific directory and want to highlight files / directories
> which are hidden. How to recognize a file / directory as it's hidden?
>
> This particular application could be running on Unix / Linux platform.
> Is there any common method which gives information as the file is
> hidden? Or if it is possible using file header?
>
> Please suggest.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Getting Started with Mac OS X

2012-02-28 Thread Praveen Rachabattuni
Hi,

I am using on Mac OS X Lion and its working pretty well.
Seems there is something wrong with your django installation, try 
reinstalling 

$ pip uninstall django
$ pip install django

Hope that helps.

Regards,
Praveen R

On Tuesday, 28 February 2012 06:06:21 UTC+5:30, JChlipala wrote:
>
> Hello, 
>
> I am a Django beginner, and am trying to get Django set up in Mac OS 
> X.  I am going through the tutorial, but getting stuck very early 
> (essentially at the beginning).  I have installed Python and Django. 
> The next instruction is to enter the command "django-admin.py 
> startproject mysite".  When I do this, I get the following error: 
>
> File "", line 1 
> django-admin.py startproject mysite 
> ^ 
>
> SyntaxError:  invalid syntax 
>
> Does anybody know why I am getting this error?  The tutorial has a 
> note for Mac OS X users explaining what to do if you get a "permission 
> denied" error, but that is obviously not what is happening to me. 
>
> Thank you for any help!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/39Bcwp2cUHgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django custom authentication

2013-10-22 Thread Praveen Madhavan
Hello All,

 I am trying custom authentication with django, I wrote a class and 
filled it with the methods authenticate and get_user, I also added this 
authentication to the AUTHENTICATION_BACKENDS in settings.py file.

I have called my custom authenticate method and followed it up with 
login in my view.

Everything seems to work fine, is_authenticated returns true for the 
user after login, but the subsequent requests have request.user as 
anonymous, unable to figure out the reason, require your help


Thanks
Praveen.M

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b2da7920-4154-4315-b4e7-957c869aa727%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django custom authentication

2013-10-22 Thread Praveen Madhavan
Tom 

Thanks for the response, here is my view

def home(request):
if not request.user.is_authenticated():
# I have written my own custom authenticate method that returns an 
user object
user=authenticate(request=request)
if not user:
return HttpResponseRedirect("/accounts")
else:
login(request,user)
return HttpResponse("Logged in Successfully")
else:
return HttpResponse(request.user)



On Tuesday, 22 October 2013 18:30:13 UTC+5:30, Tom Evans wrote:
>
> On Tue, Oct 22, 2013 at 12:53 PM, Praveen Madhavan 
> > wrote: 
> > Hello All, 
> > 
> >  I am trying custom authentication with django, I wrote a class and 
> > filled it with the methods authenticate and get_user, I also added this 
> > authentication to the AUTHENTICATION_BACKENDS in settings.py file. 
> > 
> > I have called my custom authenticate method and followed it up with 
> > login in my view. 
>
> Show us this view. You should not be calling a "custom authenticate 
> method", you should be using login() and authenticate() from 
> django.contrib.auth. If you are not, then this explains why on 
> subsequent views you are not logged in. 
>
> > 
> > Everything seems to work fine, is_authenticated returns true for the 
> > user after login, but the subsequent requests have request.user as 
> > anonymous, unable to figure out the reason, require your help 
>
> The other cause of login failing is if your browser does not send the 
> session cookie back to the server. This would happen if you have 
> configured django to send cookies with a different host than the pages 
> are served from. Use chrome inspector or firefox or any other tool you 
> fancy to determine if this is the case. 
>
> The easiest way to see is to look at the session cookie sent with the 
> pre-login page response, and the session cookie sent with the 
> post-login page response, do they have different ids? 
>
> Cheers 
>
> Tom 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/935a040b-89eb-45cb-9b3e-2e460e64f87f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-22 Thread Praveen Madhavan
Hi,
Can you please exlpain it further. I am facing the same issue. I have 
written a get_user() method in my customauthentication.py. My 
authentication is successful but the subsequent requests show up as 
anonymous user.

Thanks
Praveen.M


On Monday, 21 October 2013 16:28:12 UTC+5:30, HM wrote:
>
> Turns out: the auth backend that worked in 1.3 but not in 1.4+ was missing 
> a get_user()-method. I added it in and that was that.
>
>
> HM
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6415f4cb-2319-4f64-955b-09be2094bf0a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django custom authentication

2013-10-24 Thread Praveen Madhavan
I checked for the session cookie...
It is getting created, could it be the django version ? I am using django 
1.5 and I found few django openid apps not working on 1.5 .

On Tuesday, 22 October 2013 20:44:16 UTC+5:30, Praveen Madhavan wrote:
>
> Tom 
>
> Thanks for the response, here is my view
>
> def home(request):
> if not request.user.is_authenticated():
> # I have written my own custom authenticate method that returns an 
> user object
> user=authenticate(request=request)
> if not user:
> return HttpResponseRedirect("/accounts")
> else:
> login(request,user)
> return HttpResponse("Logged in Successfully")
> else:
> return HttpResponse(request.user)
>
>
>
> On Tuesday, 22 October 2013 18:30:13 UTC+5:30, Tom Evans wrote:
>>
>> On Tue, Oct 22, 2013 at 12:53 PM, Praveen Madhavan 
>>  wrote: 
>> > Hello All, 
>> > 
>> >  I am trying custom authentication with django, I wrote a class and 
>> > filled it with the methods authenticate and get_user, I also added this 
>> > authentication to the AUTHENTICATION_BACKENDS in settings.py file. 
>> > 
>> > I have called my custom authenticate method and followed it up with 
>> > login in my view. 
>>
>> Show us this view. You should not be calling a "custom authenticate 
>> method", you should be using login() and authenticate() from 
>> django.contrib.auth. If you are not, then this explains why on 
>> subsequent views you are not logged in. 
>>
>> > 
>> > Everything seems to work fine, is_authenticated returns true for 
>> the 
>> > user after login, but the subsequent requests have request.user as 
>> > anonymous, unable to figure out the reason, require your help 
>>
>> The other cause of login failing is if your browser does not send the 
>> session cookie back to the server. This would happen if you have 
>> configured django to send cookies with a different host than the pages 
>> are served from. Use chrome inspector or firefox or any other tool you 
>> fancy to determine if this is the case. 
>>
>> The easiest way to see is to look at the session cookie sent with the 
>> pre-login page response, and the session cookie sent with the 
>> post-login page response, do they have different ids? 
>>
>> Cheers 
>>
>> Tom 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b447397c-084f-4de1-b498-43b4557d41f6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


track on click

2013-12-20 Thread praveen pal
Dear All

 how can we keep track on click in Django?
  suppose i have a MOOC (massive open online course ) site in which user 
register for a course and 
  watch videos , attempt quiz and give answer of question i want to track 
these detail 

how  many time user watch particular video?
di user watch complete video or left it after click on start button ?
how many time time user attempt particular quiz?

is it possible?
Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/48479684-e93a-44af-804b-3bc2c2133492%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Need Customized Forms which look very much like Django admin interface ...

2007-01-25 Thread Praveen Swaminathan
I am trying to write a form which has multiple elements. One of them is a
Date field. How do I do it so that it looks like an admin interface

-- 
Thanks and Regards
Praveen

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Django tables with check box and delete button

2018-10-16 Thread Praveen Kumar
Hello,

Is there any django standard ways of creating a table with check boxes and
let the user to select multiple rows using check box and the delete?

Appreciate if anyone can help to provide an example to achieve this.

Thanks,

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB0oX7_URdpMiwqxkGrQq5tJaxeP5bqSDOspUukfs7d4gO_Mow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django tables with check box and delete button

2018-10-16 Thread Praveen Kumar
Currently I have a listview and a bootstrap table that displays the number
of records. I had tried to use request.method POST, to get the list of
checked boxes and feed it back to the delete action. However I get an error
stating that 'POST is not allowed 405' and when I looked on the web,
somewhere it states that POST doesn't work with django listview.

So any examples on generating a table with checkboxes which gives ability
to delete multiple records using a delete button would be helpful!

On Tue 16 Oct, 2018, 1:35 PM Joel Mathew,  wrote:

> There's not much difference in doing this than what is standard practise.
> You just create the regular fields, loop over the ones creating multiple
> rows, assign unique name fields to each of them (you can use
> {{for.counter}} for this). You then capture the request with
> request.POST.getlist.
>
>
>
>
> On Tue, 16 Oct 2018 at 13:27, Praveen Kumar  wrote:
>
>> Hello,
>>
>> Is there any django standard ways of creating a table with check boxes
>> and let the user to select multiple rows using check box and the delete?
>>
>> Appreciate if anyone can help to provide an example to achieve this.
>>
>> Thanks,
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAB0oX7_URdpMiwqxkGrQq5tJaxeP5bqSDOspUukfs7d4gO_Mow%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAB0oX7_URdpMiwqxkGrQq5tJaxeP5bqSDOspUukfs7d4gO_Mow%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAA%3Diw__Y80aCy7FwKsoaGhgb88gr%3DvzWHnWHE4FELW%3DwBF3r%2BA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAA%3Diw__Y80aCy7FwKsoaGhgb88gr%3DvzWHnWHE4FELW%3DwBF3r%2BA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB0oX7_QF6FxsLmKc1t2uNMN_%3DmvuutAXSGoYNkd6Q1Ft%3DdFbw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


problem in pattern matching in urls.py and redirecting to another page after few secs

2018-11-02 Thread praveen bhuvi
Now my 1st problem is in views.py i have a function , now in that function 
when certain condition is met i have to redirect to another page after 10 
sec or 20 sec.
my 2nd problem is i dont know how to set (or) match the pattern in 
[application]/urls.py

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54f8b7de-cbbd-4038-b0ab-d28bc29a8b84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Import Export on the website (not on admin page)

2018-11-08 Thread Praveen Kumar
Hi, I am looking to have an import and export button s on the user page
(not on admin page). I am aware that there is django-export-import which
can be used on the django admin page. Is there any other module/package or
can we just use django-import-export itself on the website /user view?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB0oX79jghcLKtPXi4sLjuoYTY%3DRS%2BqTP%3DwZo8X2NTZ2tvN6Zw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


ms sql server connectivity to django

2019-01-06 Thread Praveen Kumar
Hi All,

Changed DATABASE code as under in setting.py in Django project. But not 
getting able to connect to MS SQL Server. Please suggest.

ATABASES = {
'default': {
'NAME': 'APJ_AIM_LITE',
'ENGINE': 'sqlserver_ado',
'HOST': 'DB_SERVER',
'USER': '',
'PASSWORD': '',
}
}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ee503251-d646-4585-b773-0b1fc5b11c66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python Django Training

2020-02-02 Thread Praveen Kumar
I'm interested

On Sat, Feb 1, 2020, 7:12 PM Srikanth K  wrote:

> Hi,
>
> I am from Hyderabad. I am Python Developer by Profession. I am eager take
> up any Python , Django Training (online Preferrable or Weekends). Members
> who require can contact me or share me  there idea.
>
> Regards,
> Srikanth.K
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACPyz-gXb7wo9E0Uhs_pnxF9X52uA10__Fq1xt4trjXUaN3ehQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACdZTY_y%2BcOq%3Da2-N6E5YtfZfZ5XDcL9fxGPMXD3PVoA3Lo18A%40mail.gmail.com.


Error while trying to connect latest Dango with MSSQL

2019-09-17 Thread Praveen Kumar
Hi All,

Just I have updated the latest version of Dango. But now I'm getting error 
message. Please suggest me.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cf2ca49b-738e-457e-9d13-8a2df09a3a8f%40googlegroups.com.


Re: Error while trying to connect latest Dango with MSSQL

2019-09-23 Thread Praveen Kumar
p_label))

  File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\base.py
<https://f1mobile.rediff.com/cgi-bin/prored.cgi?red=http://base.py&isImage=0&BlockImage=0&rediffng=0&rdf=ACUJeVUzXi0FPVRlAz5XMVE2XgVdbQR0WWwLZwQg&rogue=539d1b24f4254e0c2dbf8660b0c56f3d0f7264d4>",
line 321, in add_to_class

value.contribute_to_class(cls, name)

  File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\
options.py
<https://f1mobile.rediff.com/cgi-bin/prored.cgi?red=http://options.py&isImage=0&BlockImage=0&rediffng=0&rdf=ACUJeVUzXi0FPVRlAz5XMVE2XgVdbQR0WWwLZwQg&rogue=c872fb7a81e0c2e3905c737644ec41bb698c69f5>",
line 204, in contribute_to_class

self.db_table = truncate_name(self.db_table,
connection.ops.max_name_length())

  File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\__init__.py",
line 28, in __getattr__

return getattr(connections[DEFAULT_DB_ALIAS], item)

  File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\utils.py
<https://f1mobile.rediff.com/cgi-bin/prored.cgi?red=http://utils.py&isImage=0&BlockImage=0&rediffng=0&rdf=ACUJeVUzXi0FPVRlAz5XMVE2XgVdbQR0WWwLZwQg&rogue=e98bb4fb2be23db0a24b1803569b6d39513ea8a1>",
line 201, in __getitem__

backend = load_backend(db['ENGINE'])

  File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\utils.py
<https://f1mobile.rediff.com/cgi-bin/prored.cgi?red=http://utils.py&isImage=0&BlockImage=0&rediffng=0&rdf=ACUJeVUzXi0FPVRlAz5XMVE2XgVdbQR0WWwLZwQg&rogue=e98bb4fb2be23db0a24b1803569b6d39513ea8a1>",
line 125, in load_backend

) from e_user

django.core.exceptions.ImproperlyConfigured: 'django.db.backends.mssql'
isn't an available database backend.

Try using 'django.db.backends.XXX', where XXX is one of:

'mysql', 'oracle', 'postgresql', 'sqlite3'


On Wed, Sep 18, 2019, 10:59 AM 'Amitesh Sahay' via Django users <
django-users@googlegroups.com> wrote:

> What is the error message? If the subject line you are talking about, its
> very generic. please be specific.
>
> Regards,
> Amitesh
>
>
> On Wednesday, 18 September, 2019, 02:06:03 am IST, Praveen Kumar <
> kumar.pravee...@gmail.com> wrote:
>
>
> Hi All,
>
> Just I have updated the latest version of Dango. But now I'm getting error
> message. Please suggest me.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/cf2ca49b-738e-457e-9d13-8a2df09a3a8f%40googlegroups.com
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/329456698.7041138.1568784512666%40mail.yahoo.com
> <https://groups.google.com/d/msgid/django-users/329456698.7041138.1568784512666%40mail.yahoo.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACdZTY-MiFOhz2Dvjp4a0CS_Vxq-n57_QNC61QqGv_T2yXgXtA%40mail.gmail.com.


[no subject]

2023-03-09 Thread Praveen Kumar
Hello Team,

Need help on creating one dashboard using Django. Please help me with it.

Thanks &Regards,
Praveen
333286

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACdZTY8aAWA_zKQBY_M_yztot33i0rEX6E9arD4y6P-hFXKV9Q%40mail.gmail.com.


You do not have permission to perform this action

2023-03-10 Thread praveen raj
If I add a login required I get the error "You do not have permission to 
perform this action".
How do I solve this problem?
   @login_required
def resolve_all_projects(self,info,**kwargs):
qs = Projects.objects.all()
print(qs.query)
return qs

[image: Capture.PNG]

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/97f7b4c6-56f4-4071-9c6c-67e42db3cd62n%40googlegroups.com.


Re:

2023-03-13 Thread Praveen Kumar
Yes, I want login structure and a dashboard in hieratical structure to show
the progress.

On Fri, Mar 10, 2023 at 8:32 PM Mir Junaid  wrote:

> what kind of dashboard
> and for what purpose
>
>
> On Fri, 10 Mar 2023 at 11:20, Praveen Kumar 
> wrote:
>
>> Hello Team,
>>
>> Need help on creating one dashboard using Django. Please help me with it.
>>
>> Thanks &Regards,
>> Praveen
>> 333286
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACdZTY8aAWA_zKQBY_M_yztot33i0rEX6E9arD4y6P-hFXKV9Q%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CACdZTY8aAWA_zKQBY_M_yztot33i0rEX6E9arD4y6P-hFXKV9Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAM%2BpT8yAnunx-%2BhyhOS%3D-Vj%3DCQjJtLmyXiguHFrMj229wpu1EQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAM%2BpT8yAnunx-%2BhyhOS%3D-Vj%3DCQjJtLmyXiguHFrMj229wpu1EQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Thanks & Regards,
Praveen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACdZTY83OsfcAsB1rSpwym41rf6O9CMoTE%2B4bBbv04sg6_H%3Dvw%40mail.gmail.com.


Re:

2023-03-13 Thread Praveen Kumar
Please suggest the training material that I need to follow

On Monday, 13 March 2023 at 14:39:46 UTC+5:30 Mir Junaid wrote:

> I can help you connect me on linkedIn on below link:
>  https://www.linkedin.com/in/junaid-ahmad-mir-a7a7561b7/
>
> On Mon, 13 Mar 2023 at 13:55, Praveen Kumar  wrote:
>
>> Yes, I want login structure and a dashboard in hieratical structure to 
>> show the progress.
>>
>> On Fri, Mar 10, 2023 at 8:32 PM Mir Junaid  wrote:
>>
>>> what kind of dashboard 
>>> and for what purpose
>>>
>>>
>>> On Fri, 10 Mar 2023 at 11:20, Praveen Kumar  
>>> wrote:
>>>
>>>> Hello Team,
>>>>
>>>> Need help on creating one dashboard using Django. Please help me with 
>>>> it.
>>>>
>>>> Thanks &Regards,
>>>> Praveen
>>>> 333286
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to django-users...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/django-users/CACdZTY8aAWA_zKQBY_M_yztot33i0rEX6E9arD4y6P-hFXKV9Q%40mail.gmail.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/CACdZTY8aAWA_zKQBY_M_yztot33i0rEX6E9arD4y6P-hFXKV9Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/CAM%2BpT8yAnunx-%2BhyhOS%3D-Vj%3DCQjJtLmyXiguHFrMj229wpu1EQ%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/CAM%2BpT8yAnunx-%2BhyhOS%3D-Vj%3DCQjJtLmyXiguHFrMj229wpu1EQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> -- 
>> Thanks & Regards,
>> Praveen
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CACdZTY83OsfcAsB1rSpwym41rf6O9CMoTE%2B4bBbv04sg6_H%3Dvw%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/django-users/CACdZTY83OsfcAsB1rSpwym41rf6O9CMoTE%2B4bBbv04sg6_H%3Dvw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e746dcb2-9a5d-459e-8117-1a63d376332dn%40googlegroups.com.


Uncaught TypeError: styled_default is not a function

2023-03-14 Thread praveen raj
Hi all,
i'm trying to django-react application with postgres db but its giving me 
the following error:
Uncaught TypeError: styled_default is not a function
at Popper.js:11:20
[image: Capture1.PNG]

here i'm using mui : 
[image: Capture2.PNG]

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8e9404ee-e223-43ee-99c9-f73e76a7055bn%40googlegroups.com.


Help on Django + Plotly integration

2023-03-22 Thread Praveen Kumar
Hi Team,

I need help in implementing Plotly with Django for interactive dashboards.

Please suggest.

Thanks & Regards,
Praveen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f4a11d66-f269-4e02-b3fe-a056d4a972ecn%40googlegroups.com.


Re: Help on Django + Plotly integration

2023-03-23 Thread Praveen Kumar
Hello Kasper,

I have followed following link to get portly chart:

https://hackmamba.io/blog/2022/03/quickly-create-interactive-charts-in-django/

But I'm not getting end result. Please find below the structure that I have 
made. Please let me know if I'm missing anything.

[image: Screenshot 2023-03-23 154859.png]

Kindly suggest.

Thanks & Regards,
Praveen
On Wednesday, 22 March 2023 at 20:38:55 UTC+5:30 Kasper Laudrup wrote:

> On 22/03/2023 15.29, Praveen Kumar wrote:
> > Hi Team,
> > 
> > I need help in implementing Plotly with Django for interactive 
> dashboards.
> > 
> > Please suggest.
> >
>
> Try following this:
>
> https://googlethatforyou.com?q=plotly%20django
>
> Kind regards,
>
> Kasper Laudrup
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ce2cb442-378f-461a-b511-712db359b8b7n%40googlegroups.com.


Re: template css issue

2023-06-06 Thread Praveen Chaudhary
This is the original template and it's working locally.


Thank you!
Your E-mail has been received
Prabin Chaudhary
+977-9840193890
*https://www.linkedin.com/in/icedreamerpraveen/
<https://www.linkedin.com/in/icedreamerpraveen/>*
Software Engineer | Youth Innovation Lab


On Wed, 7 Jun 2023 at 12:23, Praveen Chaudhary 
wrote:

> Hello Everyone,
>
> Hope you are doing well. I want a small favor from you guys.
> Here I have attached two files. These files are the email template sent
> from the django project to the outlook. The template looks correct and the
> css is working fine when I send the email from local but the css is not
> working when I deploy it to the server. You can see the difference .
> Can anyone please tell me what i am missing or doing wrong.
>
> *Prabin Chaudhary*
>
> Software Engineer | Youth Innovation Lab
>
> Mobile: +977-9840193890 | prabinchy1...@gmail.com
> 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN9B8Z03sEx_O%3DF4gFP94xDtQ_6-jY1Xr7PYNT8_kX2OBo6Gog%40mail.gmail.com.


Re: Can any one help me with this question

2023-06-18 Thread Praveen Chaudhary
Yes, Django migrations can work with Oracle 11.2 using the python-oracle
database driver. However, it's important to note that the python-oracle
package is not an official Oracle-provided driver. The official driver is
called cx_Oracle, which is widely used for connecting Django to Oracle
databases.

Here's an example of how Django migrations can work with Oracle 11.2 using
cx_Oracle:

1. Install the cx_Oracle package using pip:
 pip install cx_Oracle
2.Update your Django project's settings.py file to include the Oracle
database configuration:
 DATABASES = {
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'your_database_name',
'USER': 'your_username',
'PASSWORD': 'your_password',
'HOST': 'your_host',
'PORT': 'your_port',
}
}

Replace the 'your_database_name', 'your_username', 'your_password',
'your_host', and 'your_port' with the appropriate values for your Oracle
database.
3.Define your Django models in the models.py file.
4.Generate and apply the migrations using Django's makemigrations and
migrate commands:

These commands will generate the necessary SQL statements based on your
models and apply them to the Oracle database.

Please note that the example assumes you have already set up Oracle 11.2
and have the necessary Oracle client software installed on your machine.

It's also important to ensure that your version of Django is compatible
with Oracle 11.2. Refer to the Django documentation and the documentation
of the cx_Oracle package for any specific requirements or considerations
when working with Oracle databases.

Remember to replace 'your_database_name', 'your_username', 'your_password',
'your_host', and 'your_port' with the appropriate values for your Oracle
database configuration.

Prabin Chaudhary
+977-9840193890
*https://www.linkedin.com/in/icedreamerpraveen/
*
Software Engineer | Youth Innovation Lab


On Sun, 18 Jun 2023 at 21:15, Annadatha Rao  wrote:

> Dear All,
>
> Do DJANGO migrations work with Oracle 11.2 with python-oracle db driver,
> please show me an example if works.
>
> Thank you for your support,
> Annadatha.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFtPNJw9wQgAo2jCFEs6undCf9FZ_oqww9kZWKLLaJAMGyoNaA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN9B8Z3itg0bvV8wzoNoAkJiF9FVZ%3DAP2Z2aLxRreYxVVki1_w%40mail.gmail.com.


Re: Can any one help me with this question

2023-06-22 Thread Praveen Chaudhary
Hi Annadatha,

I'm glad to hear that upgrading to Oracle 21c worked for you. As for your
question about working without migrations in Django, it's certainly
possible but it's important to understand the implication and trade-offs.

Django migrations provide a way to manage and apply changes to your
database schema over time, allowing for version control and easy deployment
of database changes. They help maintain data integrity and make it easier
to collaborate with other developers.

However, if you prefer not to use migrations, you can disable them in
django by setting the 'MIGRATIIN_MODULES' setting to an empty dictionary in
your projects settings.py file:

 MIGRATION_MODULES = {}


By doing this, you'll essentially disable the migration framework, and
Django won't generate or apply migrations. Instead, you'll need to manually
manage your database schema changes, which can be more error-prone and less
convenient, especially in collaborative projects.

Keep in mind the following considerations if you decide to work without
migrations:

1. Database schema management: You'll need to manually create, modify, and
delete database tables, columns, and other schema elements as needed. This
requires careful coordination and communication between developers working
on the project.

2. Data integrity: Migrations help ensure data integrity during schema
changes by providing a way to define and execute data transformations.
Without migrations, you'll need to handle data migrations and
transformations manually, which can be challenging and error-prone.

3. Deployment and version control: Migrations provide a structured way to
apply schema changes to your database during deployment. Without
migrations, you'll need to find alternative approaches for managing
database changes in different environments and version controlling those
changes.

Ultimately, the decision to use or not use migrations depends on your
specific requirements, project complexity, and team collaboration. If
you're working on a small, personal project with a simple schema and
limited changes, managing the database schema manually might be feasible.
However, for larger projects or teams, migrations can provide significant
benefits in terms of maintainability, collaboration, and data integrity.

I hope this helps you make an informed decision. Let me know if you have
any further questions!

Best regards
Prabin Chaudhary
+977-9840193890
*https://www.linkedin.com/in/icedreamerpraveen/
<https://www.linkedin.com/in/icedreamerpraveen/>*
Software Engineer | Youth Innovation Lab

On Thu, 22 Jun 2023, 7:55 pm Annadatha Rao,  wrote:

> Hi  Prabin,
>
> Thank you, it worked when I upgraded db to 21c (oracle), thank you for
> your help. Small question, can I work without migrations, some have I hate
> migrations being a legacy programmer from (Cobol days). I value your
> opinion.
>
> Thank you,
> ANNADATHA.
>
> On Sun, Jun 18, 2023 at 9:19 PM Praveen Chaudhary 
> wrote:
>
>> Yes, Django migrations can work with Oracle 11.2 using the python-oracle
>> database driver. However, it's important to note that the python-oracle
>> package is not an official Oracle-provided driver. The official driver is
>> called cx_Oracle, which is widely used for connecting Django to Oracle
>> databases.
>>
>> Here's an example of how Django migrations can work with Oracle 11.2
>> using cx_Oracle:
>>
>> 1. Install the cx_Oracle package using pip:
>>  pip install cx_Oracle
>> 2.Update your Django project's settings.py file to include the Oracle
>> database configuration:
>>  DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.oracle',
>> 'NAME': 'your_database_name',
>> 'USER': 'your_username',
>> 'PASSWORD': 'your_password',
>> 'HOST': 'your_host',
>> 'PORT': 'your_port',
>> }
>> }
>>
>> Replace the 'your_database_name', 'your_username', 'your_password',
>> 'your_host', and 'your_port' with the appropriate values for your Oracle
>> database.
>> 3.Define your Django models in the models.py file.
>> 4.Generate and apply the migrations using Django's makemigrations and
>> migrate commands:
>>
>> These commands will generate the necessary SQL statements based on your
>> models and apply them to the Oracle database.
>>
>> Please note that the example assumes you have already set up Oracle 11.2
>> and have the necessary Oracle client software installed on your machine.
>>
>> It's also imp

Re: Project together

2023-12-07 Thread praveen raj
Im interested

On Thu, 23 Nov, 2023, 11:43 pm Youssef Bachraoui, <
bachraouiyouss...@gmail.com> wrote:

> Hi developer i search to make a group on WhatsApp to begin a project
> together anyone interested about that?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d5244e76-6bd3-4bde-bf31-a72720bee1acn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABn%2BeM2Ed9v4uSjFxF6%2BkF37_p7HoOVPL8w1n5%3DtHsaUPSfjoQ%40mail.gmail.com.


Re: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-19 Thread Praveen Thakur
I,m interested. Can you provide more details?

On Mon, 19 Feb 2024, 05:35 Suchak Niraula,  wrote:

> Interested. Can you send the details?
>
> On Sun, Feb 18, 2024, 22:33 SURAJ TIWARI  wrote:
>
>> 🚀 Join Our Django WhatsApp Bulk Messaging Project!
>>
>> 👋 Hello everyone,
>>
>> Are you looking for an exciting opportunity to gain hands-on experience
>> in Django development? Do you want to work on a meaningful project that
>> leverages WhatsApp for bulk messaging? We're thrilled to invite you to join
>> our dynamic team!
>>
>> 🌟 Benefits:
>>
>>- Get hands-on experience working on a real-world Django project.
>>- Learn how to leverage WhatsApp for bulk messaging, a valuable skill
>>in today's digital landscape.
>>- Opportunities for hybrid work, allowing flexibility in your
>>schedule.
>>- Collaborate with experienced developers and gain valuable
>>mentorship.
>>- Access to cutting-edge tools and technologies.
>>
>> 💼 Opportunities Available:
>>
>>- Django developers
>>- Frontend developers
>>- UI/UX designers
>>- Quality assurance testers
>>
>> 🤝 How to Join: Simply reply to this message expressing your interest,
>> and we'll provide you with all the necessary details to get started on our
>> project.
>>
>> Let's work together to create something amazing and gain valuable
>> experience along the way! 💻✨
>>
>> Best regards,
>>
>> Suraj Tiwari
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/e8a705fd-10d9-4c1a-b4ba-0a7b896dbfean%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BcAA3MiOtiy9X0GZJY0Pg6NzpFgEX8hF%3DfzH0P%3Dhe2uOOMF7w%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOFN2fakGjnvMHR7JPLDxiLwN4dPtJMNOF-5VS2A16HubxkooA%40mail.gmail.com.


Re: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-22 Thread praveen raj
Interested. Please include me.



On Sun, 18 Feb, 2024, 10:18 pm SURAJ TIWARI,  wrote:

> 🚀 Join Our Django WhatsApp Bulk Messaging Project!
>
> 👋 Hello everyone,
>
> Are you looking for an exciting opportunity to gain hands-on experience in
> Django development? Do you want to work on a meaningful project that
> leverages WhatsApp for bulk messaging? We're thrilled to invite you to join
> our dynamic team!
>
> 🌟 Benefits:
>
>- Get hands-on experience working on a real-world Django project.
>- Learn how to leverage WhatsApp for bulk messaging, a valuable skill
>in today's digital landscape.
>- Opportunities for hybrid work, allowing flexibility in your schedule.
>- Collaborate with experienced developers and gain valuable mentorship.
>- Access to cutting-edge tools and technologies.
>
> 💼 Opportunities Available:
>
>- Django developers
>- Frontend developers
>- UI/UX designers
>- Quality assurance testers
>
> 🤝 How to Join: Simply reply to this message expressing your interest,
> and we'll provide you with all the necessary details to get started on our
> project.
>
> Let's work together to create something amazing and gain valuable
> experience along the way! 💻✨
>
> Best regards,
>
> Suraj Tiwari
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e8a705fd-10d9-4c1a-b4ba-0a7b896dbfean%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABn%2BeM1d4uJRdmG96_GBx_3AK21GpkKaDoZVPPanBC%2BmBZ44vA%40mail.gmail.com.


Apscheduler is not running multiple jobs

2024-02-25 Thread Praveen Chaudhary
Hello, everyone

I am using an apscheduler to schedule my job in a django project. here is
code

def start():
"""
The `start` function creates a report using a scheduler to generate and
send reports based on
specified sources and schedules.
"""
logger.info(f" Started creating report")

executors = {
'default': ThreadPoolExecutor(1)
}

scheduler = BackgroundScheduler(executors=executors, daemon=True)

sources, idx_list, job_schedules, triggers = generate_report()

for source, idx, job_schedule, trigger in zip(sources, idx_list,
job_schedules, triggers):
job_id = f"daily_report_job_{source.name}_{job_schedule.pk}_{idx}"
logger.info(f" Adding job with ID: {job_id}")

try:
scheduler.add_job(
generate_and_send_report_by_source_name,
trigger=trigger,
id=job_id,
args=[source],
replace_existing=True,

)
except Exception as e:
logger.error(f" Failed to add job with ID {job_id}: {e}")

try:
if scheduler.state == 0:
scheduler.start()
except Exception as e:
logger.error(f" Scheduler failed to start: {e}")


def generate_report():
"""
The `generate_report` function retrieves active sources, iterates through
their job schedules,
creates triggers based on the schedule, and returns the sources, job
schedules, and triggers.
:return: The `generate_report` function returns four values: `sources`,
`idx_list`, `job_schedules`,
and `triggers`.
"""
sources = get_active_sources()
job_schedules = []
triggers = []

if not sources:
logger.error(" Failed to generate report. No active sources found.")
return [], [], []

idx_list = []
for idx, source in enumerate(sources, start=1):
source_job_schedules = source.job_schedule.all()

for job_schedule in source_job_schedules:
if job_schedule.day_of_week is not None:
trigger = CronTrigger(
day_of_week=job_schedule.day_of_week,
hour=job_schedule.hour,
minute=job_schedule.minute
)
else:
trigger = CronTrigger(
hour=job_schedule.hour,
minute=job_schedule.minute
)
triggers.append(trigger)
idx_list.append(idx)
job_schedules.append(job_schedule)

return sources, idx_list, job_schedules, triggers


here is the models.py
class JobSchedule(TimeStamp):
name = models.CharField(max_length=255)
day_of_week = models.IntegerField(choices=DAY_CHOICES, null=True, blank=True
)
hour = models.CharField(max_length=10, null=True, blank=True)
minute = models.CharField(max_length=10, null=True, blank=True)

class Meta:
verbose_name = "Job Schedule"
verbose_name_plural = "Job Schedules"

def __str__(self) -> str:
return f"{self.name}"


class Source(TimeStamp):
name = models.CharField(max_length=255, unique=True)
source_type = models.CharField(max_length=100, choices=SOURCE_TYPE, default=
"View")
query = models.TextField()
destinations = models.ManyToManyField(Destination, related_name=
"destinations")
job_schedule = models.ManyToManyField(JobSchedule, related_name="schedule")
is_active = models.BooleanField(default=False)

class Meta:
verbose_name = 'Source'
verbose_name_plural = 'Sources'

def __str__(self) -> str:
return f"{self.name}"




*the problem is when i create one source with two different job schedule
instance, apscheduler is adding only one job*


*here is my my log message:*
apscheduler.schedulerAdded job "generate_and_send_report_by_source_name" to
job store "default"




*but it works if i create two source instances with two different job
schedule instances. *


*What are the mistakes I am making? I have tried many times to solve this
issue but did not recognize what I am missing.*


*Prabin Chaudhary*

Software Engineer

Mobile: +977-9840193890 | prabinchy1...@gmail.com  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN9B8Z07qB7a336TRwju0uPzdXe7NeC%3DtYVvVStcCv3%3DjMpPzQ%40mail.gmail.com.


How to send email from django without authenticate smtp server

2024-03-04 Thread Praveen Chaudhary
Hello everyone,

Basically, I want to send the email from django using smtp server. I have
my own smtp server domain host at port 25, but don't want to pass
EMAIL_HOST_USER & EMAIL_HOST_PASSWORD. I am using EmailMultiAlernatives to
send the html and file, I am unable to send email without EMAIL_HOST_USER &
EMAIL_HOST_PASSWORD

Thank you for your help.

*Prabin Chaudhary*

Software Engineer

Mobile: +977-9840193890 | prabinchy1...@gmail.com  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN9B8Z08UcPUVgcz19GNXc%2BcYeSQTEraYvGT2xrMNo_%3DmBX2_g%40mail.gmail.com.


Re: Run an application periodically on django

2011-08-04 Thread Praveen Krishna R
*If you are on Linux machine, you can use cron jobs to schedule the jobs.*
*
*
*When I faced such a problem what I did was, I created a view to update my
site with a secret Url. I have scheduled a cron job to call this url. So
when the view gets called (with "curl" command I'm correct), the site gets
updated. **I can call this url from a browser also, anytime. **There should
be definitely  better methods of doing this, like importing django to make a
standalone app or something?! I haven't tried it yet!*
*
*
*
*
*On djcelery, I think you need to configure RabbitMQ or something to work
with!? correct me Kenneth, if I'm wrong. *

On Thu, Aug 4, 2011 at 8:12 AM, Mohamed Ghoneim wrote:

> Hey guys,
>
> I am new to djnago and I have heard a lot about its powerful capabilities,
> so I preferred it over other web frameworks.
>
> My problem is I have a webpage that its content should be updated
> automatically every 30 seconds as I build an app that gets data from another
> web page
> and parse it and then updates my webpage.
>
> My problem is how can I schedule this this app to run every 30 seconds? and
> can I do this on a hosting website?
> --
> Mohamed Sayed Ghoneim
>
>  --
> 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...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Thanks and Regards,
*Praveen Krishna R*

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



Re: dull look after install on ubuntu

2011-08-09 Thread Praveen Krishna R
*please dump your *settings.py ?!

On Wed, Aug 10, 2011 at 5:53 AM, Peter Kovgan wrote:

> Thank you guys.
>
> I use development server of django(manage.py runserver).
>
> I created an app. from the official site of the django, this one of the
> first tutorial.
>
> I did it on windows installation.
>
> Then I came home, installed the same app on ubuntu.
>
> Now my conf is:
>
> > django 1.3
> > on python 2.7.1
> > ubuntu 11.04
> > looking through firefox 4
>
> and it stopped show "stattic content"
>
> HERE IS COLLECTSTATIC::
>
> peter@peter-big:~/work/django/projects/src/mysite$ python manage.py
> collectstatic
> Traceback (most recent call last):
>   File "manage.py", line 14, in 
> execute_manager(settings)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
> line 438, in execute_manager
> utility.execute()
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
> line 379, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
> line 261, in fetch_command
> klass = load_command_class(app_name, subcommand)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
> line 68, in load_command_class
> return module.Command()
>   File
> "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
> line 41, in __init__
> self.storage = get_storage_class(settings.STATICFILES_STORAGE)()
>   File
> "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/storage.py",
> line 23, in __init__
> raise ImproperlyConfigured("You're using the staticfiles app "
> django.core.exceptions.ImproperlyConfigured: You're using the staticfiles
> app without having set the STATIC_ROOT setting.
>
> I tried to resolve it myself, but nothing has worked.
>
> I used answers to another threads, but probably my installation is somehow
> different.
>
> What exactly I specify in MEDIA_ROOT = ''" ?
>
> Thank you.
>
>
>
>
>
>
>
>
> On 10 August 2011 00:29, Gelonida N  wrote:
>
>> On 08/09/2011 09:58 PM, Peter Kovgan wrote:
>> > django 1.3
>> > on python 2.7.1
>> > ubuntu 11.04
>> > looking through firefox 4
>> >
>> > Dull look, like all javascript has been removed
>> > On windows looks nice, but here all works, but no colors, no styles,
>> > nothing...
>> >
>> > What could it be?
>>
>>
>> Well you don't really give a lot of info, so my guess might be
>> completely wrong.
>>
>>
>> Do you use the django development server (  manage.py runserver) or do
>> you run with apache / some existing server?
>>
>> Did you run the command "manage.py collectstatic"?
>>
>>
>>
>> --
>> 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...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> 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...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Thanks and Regards,
*Praveen Krishna R*

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



Re: spam in response to posting to this list

2011-08-10 Thread Praveen Krishna R
*+1
*
On Wed, Aug 10, 2011 at 7:32 PM, Kayode Odeyemi  wrote:

> I have been getting this too.
>
>
> On Wed, Aug 10, 2011 at 5:15 PM, Tom Evans wrote:
>
>> On Wed, Aug 10, 2011 at 5:06 PM, Eric Hutchinson
>>  wrote:
>> > I responded to the thread about ordering tables, and got this as a
>> > response
>> >
>>
>> I reported the same thing a couple of days ago. Russell Keith-Magee is
>> aware of the issue (he gets them too), but it seems almost impossible
>> to track down a specific subscriber from the info in that email.
>>
>> Cheers
>>
>> Tom
>>
>> --
>> 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...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
> --
> Odeyemi 'Kayode O.
> http://www.sinati.com. t: @charyorde
>
>
>  --
> 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...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Thanks and Regards,
*Praveen Krishna R*

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



Re: How to create a sub-app directly

2011-08-21 Thread Praveen Krishna R
*Is there  a concept of sub-apps exist in Django !?*
*I knew some concepts like independant reusable apps.*
*You can easily handle the rest with your urls right ?! correct me?
*
On Sun, Aug 21, 2011 at 6:27 PM, Subhranath Chunder wrote:

> Extend the manage.py functionality, by adding your custom command.
> https://docs.djangoproject.com/en/dev/howto/custom-management-commands/
>
>
> On Sun, Aug 21, 2011 at 8:52 PM, Jim  wrote:
>
>> Hello folks,
>>
>> Here is the story. I created a site, mysite, with this command django-admin
>> startproject mysite. Then, under the directory mysite/, I created an app
>> named apps with this command ./manage.py startapp apps. apps is meant to
>> hold all applications for mysite. Now, here comes the question:
>> *How do I create a sub-app under apps with manage.py directly?*
>>
>> I tried
>> ../manage.py startapp someapp
>> under apps/, but that created the someapp under mysite/ rather than under
>> apps/.
>>
>> I also tried
>> ./manage.py startapp apps/someapp
>> and
>> ./manage.py startapp apps.someapp
>> under mysite/, but neither worked.
>>
>> So, my current work-around is to create a sub-app under mysite/ first,
>> then move it into apps/ manually. But that seems dumb, and I suspect there
>> is a simpler way to do this.
>>
>> Thanks for reading this. Any help is certainly appreciated.
>>
>> Jim
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/QtvEmvU5QvMJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Thanks,
> Subhranath Chunder.
> www.subhranath.com
>
>  --
> 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...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Thanks and Regards,
*Praveen Krishna R*

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



Re: Help installing django-sentry

2011-08-22 Thread Praveen Krishna R
*(I have never used the package you mentioned. )
Do you think you have configured the urls ( /sentry in your case ) for the
django-sentry !?
*
On Sun, Aug 21, 2011 at 11:18 PM, tharshan muthulingam  wrote:

> Hi,
> I have been having alot of trouble trying to install and run django-sentry.
> My project directory is ~/django_projects/Project
>
> Inside there i have the simple polls app from the tutorial, and I have
> installed sentry using pip. I have added it to the list of installed apps.
>
> When I go to the sentry directory I got this error:
> http://127.0.0.1:8000/sentry/
>
> ViewDoesNotExist at /sentry/Tried result in module polls.views. Error was:
> 'module' object has no attribute 'result'
>
> I honestly have no clue what that means, and I would really appreciate some
> help with fixing this.
>
> Thank you!!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/XAczs-79BVMJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Thanks and Regards,
*Praveen Krishna R*

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



Re: How to make an app independent on a specific site?

2011-08-23 Thread Praveen Krishna R
*Even if you write

from models import Publisher, Book, Author

its gonna work, inside the books application;
*
On Wed, Aug 24, 2011 at 7:09 AM, Jim  wrote:

> Greetings, everyone.
>
> I am new to Django, and much of my knowledge comes from the Django book
> version 2 <http://www.djangobook.com/en/2.0/>. In the book, a site,
> mysite, is created for demo purposes. And an app, books, is also created for
> demo purposes. In the file, mysite/books/admin.py, there is a line like
> this:
>
>
> from mysite.books.models import Publisher, Author, Book
>
> It seems to me that this line makes the app dependent on the name of the
> site, which is mysite. There is a possibility that an app you have developed
> for a site might turn out to have generic use. So, I think it is a good idea
> to always keep an app independent on the site as much as possible.
>
> Here is the question. Is it possible that to store the site name into a
> variable, such as site_name, then construct a statement like the following?
>
> statement = 'from ' + site_name + '.books.models import Publisher' 
> exec(statement)
> # I am not sure if exec is a legitimate function. Here is just an example
>
>
>
>
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Jn_07ca2t6MJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Thanks and Regards,
*Praveen Krishna R*

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



  1   2   >