Save data from list display page django admin

2013-12-11 Thread Nikhil Verma
Hi All

Need help in solving this question !

http://stackoverflow.com/questions/20513675/how-to-save-data-from-list-display-page-in-django-admin

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/CABgq%3DFw7wGcYPjXnKnW0e7-6yvLUZ_VvijvJcVk4gcURz5phyg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


access request variable from middlewares into my main project urls

2013-05-21 Thread Nikhil Verma
Hello Guys


I want to make the urls dynamic and change according to roles in the
project for every app.
Example if there is role x so it should change like x/manage/view_name() ,
if the role is admin the urls will become  /admin/manage/view_name().

So basically i want to know how can i access request variable from
middlewares into my main project urls.
I know how to access template context processors but want  to  learn how to
access request in urls.

This is what i have written

url_variable = 'corporate'

for app_name in settings.INSTALLED_APPS:
if not app_name in excluded_apps:
app = get_app(app_name)


#---
# Per module url

#---
for model in get_models(app):
model = model._meta.module_name[5:]
url_path = r"^manage/%s/?$" % (model.lower())
view_name = "admin_manage_%s" % (model.lower())
urlpatterns += patterns('project_name.%s.views' % app_name,
  url(url_path, view_name,
name=view_name),)

Thanks in advance

-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-02 Thread Nikhil Verma
Hi

I don't understand your question properly but i think this might help you..


#---
# Calculating the aspect ratio of uploaded profile picture
# It compresses the image accordingly.This has been studided
# from PIL documentation
#---

def handle_uploaded_file(request):
"""
uploading the image
"""
profile_pic = request.FILES['profile_image']
poster_wip = Image.open(profile_pic)
owidth= poster_wip.size[0]
oheight = poster_wip.size[1]
if owidth > oheight:
if oheight <= 200:
pass
else:
maxSize=(200*owidth/oheight, 200)
poster_wip.thumbnail(maxSize, Image.ANTIALIAS)

else:
if owidth <= 150:
pass
else:
maxSize=(150, 150*oheight/owidth)
poster_wip.thumbnail(maxSize, Image.ANTIALIAS)

resized_posterFile = StringIO()
poster_wip.save(resized_posterFile, "PNG")
resized_posterFile.seek(0)

posterFile=InMemoryUploadedFile(resized_posterFile, None,
str(profile_pic), 'image/jpeg', len(resized_posterFile.getvalue()), None)
destination = open(MEDIA_ROOT + '/profile/'+ str(profile_pic), 'wb+')
for chunk in posterFile.chunks():
destination.write(chunk)

destination.close()

return HttpResponse(str(profile_pic))
#---


This is from PIL May be this piece of code can help you.



On Sun, Feb 3, 2013 at 10:49 AM, Babatunde Akinyanmi
<tundeba...@gmail.com>wrote:

> Hi nymo,
> I don't know the answer to your question but I can supply some advice.
> One good thing about open source is that the source is available for you
> to look at. Download one of such apps, look at the source to see how to
> creator solved the problem. From there, you can learn a way to do it or get
> inspiration to follow a more efficient or elegant route.
>
> Sent from my Windows Phone
> --
> From: nYmo
> Sent: 2/2/2013 9:44 PM
> To: django-users@googlegroups.com
> Subject: On the fly image resize
>
> Hi all,
> I'm new to django and also python but have already some programming
> experience. I'm currently creating my first application in django and get
> stucked because I'm looking for the best way to resize uploaded images.
> I'm already so far that I can upload/delete/update my images and show them
> in my view. Now I want to resize the images for my view and thought about
> the best way?
>
> First question: Is it possible to resize the images on the fly? For
> example I uploaded an image in 1920x1080px and now want to transform it to
> 400x200 or something similar when the view is being loaded? Is this a
> convenient way in django or not?
>
> The only other way in my opinion could be to resize the image during the
> file is being uploaded. What I don't like about this is that I have more
> than one copy of one image only because of different image sizes.
>
> Any other thoughs?
>
> I know that there are some nice packages out there where such problems are
> already solved. But since I'm new to django I want to learn by myself how
> to accomplish the basic stufff :)
>
> Thanks in advance
>
> Regards nymo
>
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: initial argument in forms not working for me

2013-01-27 Thread Nikhil Verma
Sorry I made a typo in last email .

Can anybody explain what mistake i am  doing ?

Hi

I am using django 1.4.3 and have a field in form


 PROFILE_TYPE = (
('public', 'Public'),
('private', 'Private'),
)
 profile_type = forms.CharField(max_length=10, widget=RadioSelect

>
>  (choices=PROFILE_TYPE),
>initial='Public',
>required=False
>)
>

Thanks



On Mon, Jan 28, 2013 at 11:05 AM, Nikhil Verma <varma.nikhi...@gmail.com>wrote:

> Hi
>
> I am using django 1.4.3 and have a field in form
>
>
>  PROFILE_TYPE = (
> ('public', 'Public'),
> ('private', 'Private'),
> )
>  profile_type = forms.CharField(max_length=10, widget=RadioSelect
>(choices=PROFILE_TYPE),
>initial='Public',
>required=False
>)
>
> I want that when i open this form the radio button with choice public
> should be pre selected.
> Can anybody explain what mistake you are doing ?
>
> Thanks
>
>
> --
> Regards
> Nikhil Verma
> +91-958-273-3156
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

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




initial argument in forms not working for me

2013-01-27 Thread Nikhil Verma
Hi

I am using django 1.4.3 and have a field in form


 PROFILE_TYPE = (
('public', 'Public'),
('private', 'Private'),
)
 profile_type = forms.CharField(max_length=10, widget=RadioSelect
   (choices=PROFILE_TYPE),
   initial='Public',
   required=False
   )

I want that when i open this form the radio button with choice public
should be pre selected.
Can anybody explain what mistake you are doing ?

Thanks


-- 
Regards
Nikhil Verma
+91-958-273-3156

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




Re: PHP vs Django

2013-01-27 Thread Nikhil Verma
Google or any other company  looks for core python guys not web developer.
If you work on core python skills i think you will have a chance.

Always think work for yourself not for any company. You will learn a lot
and learn quickly.
Thats what people suggests me. Rest is what your stage of life is ?

Thanks


On Mon, Jan 28, 2013 at 9:24 AM, Vijaya Reddy P R <prvr.pyt...@gmail.com>wrote:

> Is it possible to get job in companies like Google,Amazon,Cisco,.
>
>
> On Sun, Jan 27, 2013 at 7:50 PM, Nikhil Verma <varma.nikhi...@gmail.com>wrote:
>
>> Well i would say  its all about money and passion for programming.In Web
>> development you are uncertain which you have to learn next.
>>
>> My personnel opinion:-
>>
>> php is a crap. Its a horrible language.
>>
>> Python well i would say the king of all and the framework Django is
>> amazing.
>>
>> Thanks
>>
>>
>>
>> On Mon, Jan 28, 2013 at 9:10 AM, Londerson Araújo <londer...@gmail.com>wrote:
>>
>>> Man, i work with PHP for 5 years more or less, and Python is the
>>> the answer for my life.
>>>
>>> --
>>> 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?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>>
>> --
>> Regards
>> Nikhil Verma
>> +91-958-273-3156
>>
>>  --
>> 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?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: PHP vs Django

2013-01-27 Thread Nikhil Verma
Well i would say  its all about money and passion for programming.In Web
development you are uncertain which you have to learn next.

My personnel opinion:-

php is a crap. Its a horrible language.

Python well i would say the king of all and the framework Django is amazing.

Thanks


On Mon, Jan 28, 2013 at 9:10 AM, Londerson Araújo <londer...@gmail.com>wrote:

> Man, i work with PHP for 5 years more or less, and Python is the
> the answer for my life.
>
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Django Nested template block

2013-01-14 Thread Nikhil Verma
Hi All

I am want some help in django nested template blocks

How can i achieve this ?

base.html
{% block parent %}
{% block child %}
{% endblock child %}
{% endblock parent %}


blog.html
{% extends "base.html" %}

{% block child %}
I am overriding child
{% endblock child %}


Thanks

-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: alternate way for nested inline in django admin

2012-12-29 Thread Nikhil Verma
Hi All

Can somebody explain me the workaround for this ticket 9025. I want to
nested inlines in my django admin
explained below.

Thanks in advance

On Fri, Dec 28, 2012 at 10:54 PM, Nikhil Verma <varma.nikhi...@gmail.com>wrote:

> Hi Guys
>
> Here are my models :-
>
> class Blog(models.Model):
> """
> This model represents information that is stored about a blog.
> """
>
> seo_tag = models.CharField(max_length=100)
> title = models.CharField(max_length=100, unique=True)
> description = models.TextField(verbose_name="content")
> meta_description = models.TextField(max_length=5000)
> image = models.ImageField(upload_to="blogs/images/", blank=True)
> video = models.FileField(upload_to="blogs/videos/", blank=True)
>   and so on 
>
> class BlogSidebarTitle(models.Model):
> """
> Describes the related title and sublinks inside
> the custom sidebar
> """
>
> associated_blog = models.ForeignKey(Blog)
> title = models.CharField(max_length=255,null=True,blank=True)
> title_sequence = models.IntegerField(null=True,blank=True)
>
> def __unicode__(self):
> return self.title
>
> #---
>
> class BlogSidebarSubtitle(models.Model):
> """
> Subtitle within the sidebar
> """
> associated_blog = models.ForeignKey(Blog)
> title = models.ForeignKey(BlogSidebarTitle)
> sublink_title = models.CharField(max_length=255,null=True,blank=True)
> sublink_title_sequence = models.IntegerField(null=True,blank=True)
> sublink_title_url = models.URLField(blank=True,null=True)
>
> def __unicode__(self):
> return self.sublink_title
>
>
>
> Now i want that if i go to add blog page in admin i can add multiple
> subtitle  for a single title
>
> Like this :-
>
> Add blog Page :-
> After blog fields in admin
> # I want that it should be Tabularline
> Fieldset Blog Sidebar title
> Title Title sequence
> # after this is should be having
>Sublink_title sublink_title_sequence
> sublink _title_url
># then is hould be able to add more subtitle to single title
>+ Add another Sublink title
>
> So i wrote the admin like this :-
>
>
> #---
> class BlogSidebarSubtitleInline(admin.TabularInline):
> """
> """
>
> models = BlogSidebarSubtitle
> extra = 1
>
> #---
> class BlogSidebarTitleInline(admin.TabularInline):
> """
> Making it appear on blog screen
> """
>
> model = BlogSidebarTitle
> extra = 1
>
> #---
> class BlogSidebarTitleAdmin(admin.ModelAdmin):
> inlines = [BlogSidebarSubtitleInline,]
> extra = 1
>
> class BlogAdmin(admin.ModelAdmin):
> """
> Finally the layout of it.
> """
>
> # For tags
> filter_horizontal = ('tags',)
>
> # Calling the Editor
> class Media:
> js = (
>   '/static/tinymce/jscripts/tiny_mce/tiny_mce.js',
>   '/static/js/textarea.js',
>   )
> # Finally diving the page into fieldsets
> fieldsets = [
> ('Blog',{'fields': ['seo_tag', 'title','meta_description',
> 'description',
>     'category', 'image','video', 'save_as_draft',
> 'featured', 'tags']})]
> #readonly_fields = ['seo_tag',]
>
> inlines = [BlogSidebarButtonsInline, BlogSidebarTitleInline]
>
>
> But still the BlogSidebarSubtitle class fields are not appearing in admin
> and i am not able to have nested inlines.
>
> Can anybody tell the appropriate way to do this and if not where i am
> doing wrong in the above code.
>
> Thanks  .
> --
> Regards
> Nikhil Verma
> +91-958-273-3156
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

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



alternate way for nested inline in django admin

2012-12-28 Thread Nikhil Verma
Hi Guys

Here are my models :-

class Blog(models.Model):
"""
This model represents information that is stored about a blog.
"""

seo_tag = models.CharField(max_length=100)
title = models.CharField(max_length=100, unique=True)
description = models.TextField(verbose_name="content")
meta_description = models.TextField(max_length=5000)
image = models.ImageField(upload_to="blogs/images/", blank=True)
video = models.FileField(upload_to="blogs/videos/", blank=True)
  and so on 

class BlogSidebarTitle(models.Model):
"""
Describes the related title and sublinks inside
the custom sidebar
"""

associated_blog = models.ForeignKey(Blog)
title = models.CharField(max_length=255,null=True,blank=True)
title_sequence = models.IntegerField(null=True,blank=True)

def __unicode__(self):
return self.title

#---

class BlogSidebarSubtitle(models.Model):
"""
Subtitle within the sidebar
"""
associated_blog = models.ForeignKey(Blog)
title = models.ForeignKey(BlogSidebarTitle)
sublink_title = models.CharField(max_length=255,null=True,blank=True)
sublink_title_sequence = models.IntegerField(null=True,blank=True)
sublink_title_url = models.URLField(blank=True,null=True)

def __unicode__(self):
return self.sublink_title



Now i want that if i go to add blog page in admin i can add multiple
subtitle  for a single title

Like this :-

Add blog Page :-
After blog fields in admin
# I want that it should be Tabularline
Fieldset Blog Sidebar title
Title Title sequence
# after this is should be having
   Sublink_title sublink_title_sequence
sublink _title_url
   # then is hould be able to add more subtitle to single title
   + Add another Sublink title

So i wrote the admin like this :-

#---
class BlogSidebarSubtitleInline(admin.TabularInline):
"""
"""

models = BlogSidebarSubtitle
extra = 1
#---
class BlogSidebarTitleInline(admin.TabularInline):
"""
Making it appear on blog screen
"""

model = BlogSidebarTitle
extra = 1
#---
class BlogSidebarTitleAdmin(admin.ModelAdmin):
inlines = [BlogSidebarSubtitleInline,]
extra = 1

class BlogAdmin(admin.ModelAdmin):
"""
Finally the layout of it.
"""

# For tags
filter_horizontal = ('tags',)

# Calling the Editor
class Media:
js = (
  '/static/tinymce/jscripts/tiny_mce/tiny_mce.js',
  '/static/js/textarea.js',
  )
# Finally diving the page into fieldsets
fieldsets = [
('Blog',{'fields': ['seo_tag', 'title','meta_description',
'description',
'category', 'image','video', 'save_as_draft',
'featured', 'tags']})]
#readonly_fields = ['seo_tag',]

inlines = [BlogSidebarButtonsInline, BlogSidebarTitleInline]


But still the BlogSidebarSubtitle class fields are not appearing in admin
and i am not able to have nested inlines.

Can anybody tell the appropriate way to do this and if not where i am doing
wrong in the above code.

Thanks  .
-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Set Permissions in User model from views

2012-12-06 Thread Nikhil Verma
Hi Tom

Thanks for replying .I looked at this
http://parand.com/say/index.php/2010/02/19/django-using-the-permission-system/

and got that point.
def register_user(data):
> """
> This method is used to register a new user and create a user profile.
> """
> password = hashlib.sha1(data['confirm_
password']).hexdigest()
>
> new_user = User(username=data['email'], email=data['email'],
> is_staff=True
> )
> new_user.set_password(data['confirm_password'])
> # At this point i want to set the permission in choose permission box
from the available user_permission box ! How can i do this ?
>
Basically i want to put some of the permissions into Choose permission Box
from Available permission box from code and not manually by going to the
admin.

Thanks



On Thu, Dec 6, 2012 at 5:20 PM, Tom Evans <tevans...@googlemail.com> wrote:

> On Thu, Dec 6, 2012 at 8:10 AM, Nikhil Verma <varma.nikhi...@gmail.com>
> wrote:
> > Hi All
> >
> > I am developing a simple app in which i have to play with user
> permissions.I
> > register a user(during a sign up process)  with this method :-
> >
> > def register_user(data):
> > """
> > This method is used to register a new user and create a user profile.
> > """
> > password = hashlib.sha1(data['confirm_password']).hexdigest()
> >
> > new_user = User(username=data['email'], email=data['email'],
> > is_staff=True
> > )
> > new_user.set_password(data['confirm_password'])
> > # At this point i want to add user_permissions ! How can i do this ?
> > new_user.user_premissions.add('can add table_name') @ Since it is a
> > manytomany field
> >
> >How can i set permissions from this part of code ?
> > new_user.save()
> >
> >
> >
> >
> > new_user.first_name = data['title']
> > new_user.email = data['email']
> > new_user.is_locked = True
> > new_user.save()
> > new_user.user_permissions('Can add department')
> >
> > profile = new_user.profile
> > key = uuid.uuid4().__str__()
> > profile.key = key
> > profile.save()
> > if new_user and profile:
> > return new_user
> > else:
> > return False
> >
> > Thanks in advance
> >
> >
> >
>
> Permissions are just objects, fetch them from the database and add
> them to the M2M:
>
> >>> from django.contrib.auth.models import Permission, User
>
> >>> user = User.objects.get(id=1)
> >>> perm = Permission.objects.get(codename='add_user')
> >>> user.user_permissions.add(perm)
> >>> user.user_permissions.all()
> []
> >>> user.has_perm('auth.add_user')
> True
>
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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 introduce a text area as a field of a database entry

2012-12-06 Thread Nikhil Verma
Try this

content = models.TextField(blank=True,null=True)

On Thu, Dec 6, 2012 at 4:48 PM, joy <agnese.camell...@gmail.com> wrote:

> My model.py
>
> ##model.py
> from django.db import models
>
> class Text(models.Model):
>pag= models.CharField(max_length=10)
>content = models.CharField(max_length=500)
> ##should i put something different in the previous line to have a textarea
> in the admin view of this field?
>
>def __unicode__(self):
>return self.pag
>
> thanks Joy
>
> --
> 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/-/z16sMIJfAT0J.
> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Add chosen user Permission in User table from Avaliable user Permissions by writing code

2012-12-06 Thread Nikhil Verma
Hi All

I am in User Table from django auth and in the admin i am in change_forms
page .
I can clearly see that there is ManyToMany relationship field called
user_permission.
In user_permission filed we have choosen user permssion in which we choosen
permission gets saved.

However i want to set it from code  example everytime the user gets
selected i want some permissions(which is already persent in Available
permission box) get saved to choosen permission box from code.How can i do
this ?

-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Set Permissions in User model from views

2012-12-06 Thread Nikhil Verma
Hi All

I am developing a simple app in which i have to play with user
permissions.I register a user(during a sign up process)  with this method :-

def register_user(data):
"""
This method is used to register a new user and create a user profile.
"""
password = hashlib.sha1(data['confirm_password']).hexdigest()

new_user = User(username=data['email'], email=data['email'],
is_staff=True
)
new_user.set_password(data['confirm_password'])
# At this point i want to add user_permissions ! How can i do this ?
new_user.user_premissions.add('can add table_name') @ Since it is a
manytomany field

   How can i set permissions from this part of code ?
new_user.save()




new_user.first_name = data['title']
new_user.email = data['email']
new_user.is_locked = True
new_user.save()
new_user.user_permissions('Can add department')

profile = new_user.profile
key = uuid.uuid4().__str__()
profile.key = key
profile.save()
if new_user and profile:
return new_user
else:
return False

Thanks in advance



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Template syntax error: Could not parse the remainder: '-login' from 'accounts-login'

2012-12-03 Thread Nikhil Verma
Try Sign in

On Mon, Dec 3, 2012 at 6:01 PM, Loai Ghoraba <loai1...@gmail.com> wrote:

> Hi
>
> I have this in my urls.py
>
> url(r'^accounts/login/$', login,name="accounts-login")
>
> and in a template base.html
>  login
>
> And when I try to open the site, this error is raised: Template syntax
> error: Could not parse the remainder: '-login' from 'accounts-login'
>
> But when I change the name of the url in both urls.py and base.html to
> something without the score '-', it works: like :accountslogin.
>
> So are scores banned in named urls ? I have seen scored-named-urls in the
> documentation !
>
> Thanks in advance.
>
>
>  --
> 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/-/g19mRQ4vHd4J.
> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Stop executing template tag

2012-10-23 Thread Nikhil Verma
Thanks to all . But Tome and Russel answers were absolutely correct.Worked
like a charm.

{% templatetag openvariable %} hello {% templatetag closevariable




On Fri, Oct 19, 2012 at 4:16 PM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> On Fri, Oct 19, 2012 at 6:21 PM, Nikhil Verma <varma.nikhi...@gmail.com>
> wrote:
> > Hello people
> >
> > I need some suggestion in a problem.
> >
> > How can i stop django template engine  not executing {{name}}. Meaning I
> do
> > not want that {{}}, the value should be printed it should somehow pass
> into
> > the browser as it is.
> > If i writing {{name}} it should print {{name}} in html file/browser
>
> You have two options:
>
> Option 1 - Use the {% templatetag %} templatetag:
>
> https://docs.djangoproject.com/en/dev/ref/templates/builtins/#templatetag
>
> {% templatetag openvariable %} hello {% templatetag closevariable
>
> will render as
>
> {{ hello }}
>
> Option 2 -- if you have a large block of text that you want to render,
> you can use the {% verbatim %} template tag
>
> {% verbatim %}
> This {{ content }} won't be processed.
> {% endverbatim %}
>
> Unfortunately, this option is only available in Django's trunk (so it
> will be part of Django 1.5). However, there are plenty of snippets of
> code you can use (including copying Django's own implementation) that
> you can use in your own project.
>
> Yours,
> Russ Magee %-)
>
> --
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Stop executing template tag

2012-10-19 Thread Nikhil Verma
Hello people

I need some suggestion in a problem.

How can i stop django template engine  not executing {{name}}. Meaning I do
not want that {{}}, the value should be printed it should somehow pass into
the browser as it is.
If i writing {{name}} it should print {{name}} in html file/browser

How can i achieve this ?

-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: custom500 page does not show up ?

2012-07-04 Thread Nikhil Verma
Hi Melvyn,


The interesting thing is 404.html is working but not 500.html.
In settings paths are dynamically set. Also i am receiving the error
messages on my email as i am the admin.
Let say there is some syntax error so in the email it will give me
information about that but without displaying 500 page.

I am  amazed then why 404 is working.


On Wed, Jul 4, 2012 at 11:28 PM, Melvyn Sopacua <m.r.sopa...@gmail.com>wrote:

> On 4-7-2012 19:08, Nikhil Verma wrote:
> > Hi Melvyn
> >
> >
> >
> > [ ] Make sure your custom page is not sent with tools like netcat,
> > telnet or curl.
> >
> > i did not turn anything its a simple custom page.
>
> Sorry I worded that rather bad. Your goal is to connect to the page that
> triggers a 500 error with one of the tools I mentioned so you can see
> the actual response, not what your browser shows you as the browser
> could be showing you it's own "server error" page.
>
> > [ ] Make sure your custom page is not generating a 500 error by itself
> >
> > {% extends 'base.html' %}
> >
> > {% block title %}
> > 500 - Server Error
> > {% endblock %}
> >
> > {% block content %}
> > Sorry, there was an error
> >
> > 
> > 
> > We've encountered a problem.
> > 
> > 
> >
> > 
> > We apologize for any inconvenience this has caused you.
> > Citysom is undergoing constant improvement.
> > We hope that you will not have problems in the future.
> > 
> > 
> > 
> > {% endblock %}
>
> Of course, you can still have the error in base.html.
>
> > [ ] If the logger has been turned off, turn it back on and read the
> > email sent to the admin address.
> >
> > I have not put any log.
>
> See settings.py, the bottom part. If debug is set to 'off', 500 errors
> are mailed to the DJANGO_ADMIN.
>
> > The interesting part is everything is working properly in my local
> machine.
>
> [ ] Make sure that absolute paths in settings.py point to actual
> directories on the production server.
> --
> Melvyn Sopacua
>
>
> --
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: custom500 page does not show up ?

2012-07-04 Thread Nikhil Verma
Hi Melvyn



[ ] Make sure your custom page is not sent with tools like netcat,
telnet or curl.

i did not turn anything its a simple custom page.

[ ] Make sure your custom page is not generating a 500 error by itself

{% extends 'base.html' %}

{% block title %}
500 - Server Error
{% endblock %}

{% block content %}
Sorry, there was an error



We've encountered a problem.




We apologize for any inconvenience this has caused you.
Citysom is undergoing constant improvement.
We hope that you will not have problems in the future.



{% endblock %}

[ ] If the logger has been turned off, turn it back on and read the
email sent to the admin address.

I have not put any log.

The interesting part is everything is working properly in my local machine.

Thanks for help.


On Wed, Jul 4, 2012 at 9:28 PM, Melvyn Sopacua <m.r.sopa...@gmail.com>wrote:

> On 4-7-2012 5:21, Nikhil Verma wrote:
> > HI All
> >
> > I have made a custom and a very simple 500.html page. However when i make
> > debug=False and some error come in website
> > still it show basic server error message.
> >
> > "A server error has occurred.Please contact the administrator"
> >
> > I want whenever there is some error it should show my custom 500 page.
>
> Your checklist:
> [ ] Make sure your custom page is not sent with tools like netcat,
> telnet or curl.
> [ ] Make sure your custom page is not generating a 500 error by itself
> [ ] If the logger has been turned off, turn it back on and read the
> email sent to the admin address.
>
>
> --
> Melvyn Sopacua
>
>
> --
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

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



custom500 page does not show up ?

2012-07-03 Thread Nikhil Verma
HI All

I have made a custom and a very simple 500.html page. However when i make
debug=False and some error come in website
still it show basic server error message.

"A server error has occurred.Please contact the administrator"

I want whenever there is some error it should show my custom 500 page.

I tried by making a custom function and then setting the handler500="path"
but still with no luck.

Anyone can help in this as to how can i resolve this problem?

Thanks
-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Upload a valid image. The file you uploaded was either not an image or a corrupted image.

2012-07-01 Thread Nikhil Verma
Hi Thomos

I reinstalled almost everything and then simply install PIL and i get this

PIL 1.1.7 SETUP SUMMARY

version   1.1.7
platform  linux2 2.7.2+ (default, Oct  4 2011, 20:06:09)
  [GCC 4.6.1]

--- TKINTER support available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
*** LITTLECMS support not available

To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.

To check the build, run the selftest.py script.
changing mode of build/scripts-2.7/pilfont.py from 664 to 775
changing mode of build/scripts-2.7/pilfile.py from 664 to 775
changing mode of build/scripts-2.7/pilprint.py from 664 to 775
changing mode of build/scripts-2.7/pildriver.py from 664 to 775
changing mode of build/scripts-2.7/pilconvert.py from 664 to 775

changing mode of /home/nikhil/Citysom/bin/pilfont.py to 775
changing mode of /home/nikhil/Citysom/bin/pilfile.py to 775
changing mode of /home/nikhil/Citysom/bin/pilprint.py to 775
changing mode of /home/nikhil/Citysom/bin/pildriver.py to 775
changing mode of /home/nikhil/Citysom/bin/pilconvert.py to 775
Successfully installed PIL
Cleaning up...

After i have this error

The _imaging C module is not installed




On Mon, Jul 2, 2012 at 1:20 AM, Thomas Orozco <g.orozco.tho...@gmail.com>wrote:

> Did you get any error messages during the PIL instalation that indicated
> why jpeg support was unavailable? Specifically, which files could not be
> found?
>
> Maybe you don't have the correct roots included?
>
> I'm not sure Django (that's what you're using, using right?) would use
> pillow, especially when PIL is available too.
> Le 1 juil. 2012 19:34, "Nikhil Verma" <varma.nikhi...@gmail.com> a écrit :
>
> HI Thomos
>>
>> I also installed pillow and now it shows th support but i am having the
>> same error.
>>
>> 
>> SETUP SUMMARY (Pillow 1.7.7 / PIL 1.1.7)
>> 
>> version   1.7.7
>> platform  linux2 2.7.2+ (default, Oct  4 2011, 20:06:09)
>>   [GCC 4.6.1]
>> 
>> *** TKINTER support not available (Tcl/Tk 8.5 libraries needed)
>> --- JPEG support available
>> --- ZLIB (PNG/ZIP) support available
>> --- FREETYPE2 support available
>> *** LITTLECMS support not available
>> 
>> To add a missing option, make sure you have the required
>> library, and set the corresponding ROOT variable in the
>> setup.py script.
>>
>> To check the build, run the selftest.py script.
>> changing mode of build/scripts-2.7/pilfont.py from 664 to 775
>> changing mode of build/scripts-2.7/pilfile.py from 664 to 775
>> changing mode of build/scripts-2.7/pilprint.py from 664 to 775
>> changing mode of build/scripts-2.7/pildriver.py from 664 to 775
>> changing mode of build/scripts-2.7/pilconvert.py from 664 to 775
>>
>> warning: no previously-included files found matching '.hgignore'
>> warning: no previously-included files found matching '.hgtags'
>> warning: no previously-included files found matching 'BUILDME.bat'
>> warning: no previously-included files found matching
>> 'make-manifest.py'
>> warning: no previously-included files found matching 'SHIP'
>> warning: no previously-included files found matching 'SHIP.bat'
>> warning: no previously-included files matching '*' found under
>> directory 'Tests'
>> changing mode of /home/nikhil/Citysom/bin/pilfont.py to 775
>> changing mode of /home/nikhil/Citysom/bin/pilfile.py to 775
>> changing mode of /home/nikhil/Citysom/bin/pilprint.py to 775
>> changing mode of /home/nikhil/Citysom/bin/pildriver.py to 775
>> changing mode of /home/nikhil/Citysom/bin/pilconvert.py to 775
>> Successfully installed pillow
>> Cleaning up...
>> (Citysom)nikhil@nikhil-desktop:~/Citysom/citysom$ python manage.py
>> runserver 8080
>>
>>
>> On Sun, Jul 1, 2012 at 10:37 PM, Nikhil Verma 
>> <varma.nikhi...@gmail.com>wrote:
>>
>>> Hi Thomos
>>>
>>> As 

Re: Upload a valid image. The file you uploaded was either not an image or a corrupted image.

2012-07-01 Thread Nikhil Verma
HI Thomos

I also installed pillow and now it shows th support but i am having the
same error.


SETUP SUMMARY (Pillow 1.7.7 / PIL 1.1.7)

version   1.7.7
platform  linux2 2.7.2+ (default, Oct  4 2011, 20:06:09)
  [GCC 4.6.1]

*** TKINTER support not available (Tcl/Tk 8.5 libraries needed)
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
*** LITTLECMS support not available

To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.

To check the build, run the selftest.py script.
changing mode of build/scripts-2.7/pilfont.py from 664 to 775
changing mode of build/scripts-2.7/pilfile.py from 664 to 775
changing mode of build/scripts-2.7/pilprint.py from 664 to 775
changing mode of build/scripts-2.7/pildriver.py from 664 to 775
changing mode of build/scripts-2.7/pilconvert.py from 664 to 775

warning: no previously-included files found matching '.hgignore'
warning: no previously-included files found matching '.hgtags'
warning: no previously-included files found matching 'BUILDME.bat'
warning: no previously-included files found matching 'make-manifest.py'
warning: no previously-included files found matching 'SHIP'
warning: no previously-included files found matching 'SHIP.bat'
warning: no previously-included files matching '*' found under
directory 'Tests'
changing mode of /home/nikhil/Citysom/bin/pilfont.py to 775
changing mode of /home/nikhil/Citysom/bin/pilfile.py to 775
changing mode of /home/nikhil/Citysom/bin/pilprint.py to 775
changing mode of /home/nikhil/Citysom/bin/pildriver.py to 775
changing mode of /home/nikhil/Citysom/bin/pilconvert.py to 775
Successfully installed pillow
Cleaning up...
(Citysom)nikhil@nikhil-desktop:~/Citysom/citysom$ python manage.py
runserver 8080


On Sun, Jul 1, 2012 at 10:37 PM, Nikhil Verma <varma.nikhi...@gmail.com>wrote:

> Hi Thomos
>
> As you said i reinstalled it and in my  virtualenv  i did
>
> pip install -I pil
>
> It succesfully installed and i get this
>
> 
>
> PIL 1.1.7 SETUP SUMMARY
> 
> version   1.1.7
> platform  linux2 2.7.2+ (default, Oct  4 2011, 20:06:09)
>   [GCC 4.6.1]
>
> 
> *** TKINTER support not available (Tcl/Tk 8.5 libraries needed)
> *** JPEG support not available
> *** ZLIB (PNG/ZIP) support not available
>
> *** FREETYPE2 support not available
> *** LITTLECMS support not available
> 
> To add a missing option, make sure you have the required
>
> library, and set the corresponding ROOT variable in the
> setup.py script.
>
> To check the build, run the selftest.py script.
> changing mode of build/scripts-2.7/pilfont.py from 664 to 775
> changing mode of build/scripts-2.7/pilfile.py from 664 to 775
>
> changing mode of build/scripts-2.7/pilprint.py from 664 to 775
> changing mode of build/scripts-2.7/pildriver.py from 664 to 775
> changing mode of build/scripts-2.7/pilconvert.py from 664 to 775
>
>
> Removing 
> /home/nikhil/Citysom/lib/python2.7/site-packages/PIL/PIL-1.1.7-py2.7.egg-info
> changing mode of /home/nikhil/Citysom/bin/pilfont.py to 775
> changing mode of /home/nikhil/Citysom/bin/pilfile.py to 775
>
> changing mode of /home/nikhil/Citysom/bin/pilprint.py to 775
> changing mode of /home/nikhil/Citysom/bin/pildriver.py to 775
> changing mode of /home/nikhil/Citysom/bin/pilconvert.py to 775
> Successfully installed pil
>
> Cleaning up...
>
>
> and i can see that jpeg support is not available. what i need to install now ?
>
> Thanks for help !!
>
>
>
> On Sun, Jul 1, 2012 at 10:28 PM, Thomas Orozco 
> <g.orozco.tho...@gmail.com>wrote:
>
>> Now that the required packages are installed, could you try removing PIL
>> and reinstalling?
>>
>> To remove PIL, find the installation directory and the egg and remove
>> them from your system. Then, I reinstall using apt, easy install or pip.
>> Don't forget to sudo.
>> Le 1 juil. 2012 18:38, "Nikhil Verma" <varma.nikhi...@g

Re: Upload a valid image. The file you uploaded was either not an image or a corrupted image.

2012-07-01 Thread Nikhil Verma
Hi Thomos

As you said i reinstalled it and in my  virtualenv  i did

pip install -I pil

It succesfully installed and i get this


PIL 1.1.7 SETUP SUMMARY

version   1.1.7
platform  linux2 2.7.2+ (default, Oct  4 2011, 20:06:09)
  [GCC 4.6.1]

*** TKINTER support not available (Tcl/Tk 8.5 libraries needed)
*** JPEG support not available
*** ZLIB (PNG/ZIP) support not available
*** FREETYPE2 support not available
*** LITTLECMS support not available

To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.

To check the build, run the selftest.py script.
changing mode of build/scripts-2.7/pilfont.py from 664 to 775
changing mode of build/scripts-2.7/pilfile.py from 664 to 775
changing mode of build/scripts-2.7/pilprint.py from 664 to 775
changing mode of build/scripts-2.7/pildriver.py from 664 to 775
changing mode of build/scripts-2.7/pilconvert.py from 664 to 775

Removing 
/home/nikhil/Citysom/lib/python2.7/site-packages/PIL/PIL-1.1.7-py2.7.egg-info
changing mode of /home/nikhil/Citysom/bin/pilfont.py to 775
changing mode of /home/nikhil/Citysom/bin/pilfile.py to 775
changing mode of /home/nikhil/Citysom/bin/pilprint.py to 775
changing mode of /home/nikhil/Citysom/bin/pildriver.py to 775
changing mode of /home/nikhil/Citysom/bin/pilconvert.py to 775
Successfully installed pil
Cleaning up...


and i can see that jpeg support is not available. what i need to install now ?

Thanks for help !!



On Sun, Jul 1, 2012 at 10:28 PM, Thomas Orozco <g.orozco.tho...@gmail.com>wrote:

> Now that the required packages are installed, could you try removing PIL
> and reinstalling?
>
> To remove PIL, find the installation directory and the egg and remove them
> from your system. Then, I reinstall using apt, easy install or pip. Don't
> forget to sudo.
> Le 1 juil. 2012 18:38, "Nikhil Verma" <varma.nikhi...@gmail.com> a écrit :
>
> HI Thomos
>>
>> I tried this
>>
>> nikhil@nikhil-desktop:~$ sudo apt-get install libjpeg libjpeg-dev
>> libfreetype6-dev zlib1g-dev
>> Reading package lists... Done
>> Building dependency tree
>> Reading state information... Done
>> Note, selecting 'libjpeg62-dev' instead of 'libjpeg-dev'
>> E: Unable to locate package libjpeg
>> nikhil@nikhil-desktop:~$ sudo apt-get install libjpeg-dev
>> libfreetype6-dev zlib1g-dev
>> Reading package lists... Done
>> Building dependency tree
>> Reading state information... Done
>> Note, selecting 'libjpeg62-dev' instead of 'libjpeg-dev'
>> zlib1g-dev is already the newest version.
>> zlib1g-dev set to manually installed.
>> libfreetype6-dev is already the newest version.
>> libfreetype6-dev set to manually installed.
>> The following packages were automatically installed and are no longer
>> required:
>>   libopenraw1 libbabl-0.1-0 libgegl-0.2-0 libgimp2.0 gimp-data
>> Use 'apt-get autoremove' to remove them.
>> The following NEW packages will be installed:
>>   libjpeg62-dev
>> 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
>> Need to get 192 kB of archives.
>> After this operation, 500 kB of additional disk space will be used.
>> Do you want to continue [Y/n]? Y
>> Get:1 http://archive.ubuntu.com/ubuntu/ oneiric/main libjpeg62-dev amd64
>> 6b1-1ubuntu2 [192 kB]
>> Fetched 192 kB in 3s (57.9 kB/s)
>> Selecting previously deselected package libjpeg62-dev.
>> (Reading database ... 302567 files and directories currently installed.)
>> Unpacking libjpeg62-dev (from .../libjpeg62-dev_6b1-1ubuntu2_amd64.deb)
>> ...
>> Setting up libjpeg62-dev (6b1-1ubuntu2) ...
>> nikhil@nikhil-desktop:~$
>>
>>
>> Still the same error.
>>
>>
>>
>> On Sun, Jul 1, 2012 at 10:02 PM, Thomas Orozco <g.orozco.tho...@gmail.com
>> > wrote:
>>
>>> Installing the packages through apt-get gave you the error?
>>>
>>> Could you please post the full output of the apt-get command?
>>> Le 1 juil. 2012 18:27, "Nikhil Verma" <varma.nikhi...@gmail.com> a
>>> écrit :
>>>
>>>  HI Thomos
>>>>
>>>>
>>>> I tried what you suggest and i recieved this.
>>>>
>>>> sudo apt-get install libjpeg libjpeg-dev libfreetype6 libfreetype6-dev 
>>>

Re: Upload a valid image. The file you uploaded was either not an image or a corrupted image.

2012-07-01 Thread Nikhil Verma
HI Thomos

I tried this

nikhil@nikhil-desktop:~$ sudo apt-get install libjpeg libjpeg-dev
libfreetype6-dev zlib1g-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libjpeg62-dev' instead of 'libjpeg-dev'
E: Unable to locate package libjpeg
nikhil@nikhil-desktop:~$ sudo apt-get install libjpeg-dev libfreetype6-dev
zlib1g-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libjpeg62-dev' instead of 'libjpeg-dev'
zlib1g-dev is already the newest version.
zlib1g-dev set to manually installed.
libfreetype6-dev is already the newest version.
libfreetype6-dev set to manually installed.
The following packages were automatically installed and are no longer
required:
  libopenraw1 libbabl-0.1-0 libgegl-0.2-0 libgimp2.0 gimp-data
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  libjpeg62-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 192 kB of archives.
After this operation, 500 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://archive.ubuntu.com/ubuntu/ oneiric/main libjpeg62-dev amd64
6b1-1ubuntu2 [192 kB]
Fetched 192 kB in 3s (57.9 kB/s)
Selecting previously deselected package libjpeg62-dev.
(Reading database ... 302567 files and directories currently installed.)
Unpacking libjpeg62-dev (from .../libjpeg62-dev_6b1-1ubuntu2_amd64.deb) ...
Setting up libjpeg62-dev (6b1-1ubuntu2) ...
nikhil@nikhil-desktop:~$


Still the same error.



On Sun, Jul 1, 2012 at 10:02 PM, Thomas Orozco <g.orozco.tho...@gmail.com>wrote:

> Installing the packages through apt-get gave you the error?
>
> Could you please post the full output of the apt-get command?
> Le 1 juil. 2012 18:27, "Nikhil Verma" <varma.nikhi...@gmail.com> a écrit :
>
> HI Thomos
>>
>>
>> I tried what you suggest and i recieved this.
>>
>> sudo apt-get install libjpeg libjpeg-dev libfreetype6 libfreetype6-dev 
>> zlib1g-dev
>>
>> Traceback (most recent call last):
>>   File "/home/nikhil/Citysom/bin/easy_install", line 8, in 
>>
>>
>> load_entry_point('setuptools==0.6c11', 'console_scripts', 
>> 'easy_install')()
>>   File 
>> "/home/nikhil/Citysom/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py",
>>  line 1712, in main
>>
>>
>>   File 
>> "/home/nikhil/Citysom/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py",
>>  line 1700, in with_ei_usage
>>   File 
>> "/home/nikhil/Citysom/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py",
>>  line 1716, in 
>>
>>
>>   File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
>> dist.run_commands()
>>   File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
>> self.run_command(cmd)
>>
>>
>>   File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
>> cmd_obj.run()
>>   File 
>> "/home/nikhil/Citysom/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py",
>>  line 211, in run
>>
>>
>>   File 
>> "/home/nikhil/Citysom/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py",
>>  line 434, in easy_install
>>   File 
>> "/home/nikhil/Citysom/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/package_index.py",
>>  line 475, in fetch_distribution
>>
>>
>> AttributeError: 'NoneType' object has no attribute 'clone'
>>
>>
>> Thanks for help
>>
>>
>>
>>
>> On Sun, Jul 1, 2012 at 9:53 PM, Thomas Orozco 
>> <g.orozco.tho...@gmail.com>wrote:
>>
>>> Do you have jpeg support installed for PIL?
>>> Le 1 juil. 2012 18:13, "Nikhil Verma" <varma.nikhi...@gmail.com> a
>>> écrit :
>>>
>>>>
>>>> Hi All
>>>>
>>>> I am trying to add jpeg image in a ImageField. and it gives this error
>>>> . It is not allowing me to save the image.
>>>>
>>>> I have installed PIL and image other utilities.
>>>>
>>>> Upload a valid image. The file you uploaded was either not an image or
>>>> a corrupted image.
>>>>
>>>> Can anybody point what is missing ?
>>>>
>>>> Thanks in advance
>>>>
>>>>
>>>> --
>>

Re: Upload a valid image. The file you uploaded was either not an image or a corrupted image.

2012-07-01 Thread Nikhil Verma
HI Thomos


I tried what you suggest and i recieved this.

sudo apt-get install libjpeg libjpeg-dev libfreetype6 libfreetype6-dev
zlib1g-dev

Traceback (most recent call last):
  File "/home/nikhil/Citysom/bin/easy_install", line 8, in 
load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
  File 
"/home/nikhil/Citysom/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py",
line 1712, in main
  File 
"/home/nikhil/Citysom/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py",
line 1700, in with_ei_usage
  File 
"/home/nikhil/Citysom/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py",
line 1716, in 
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
  File 
"/home/nikhil/Citysom/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py",
line 211, in run
  File 
"/home/nikhil/Citysom/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py",
line 434, in easy_install
  File 
"/home/nikhil/Citysom/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/package_index.py",
line 475, in fetch_distribution
AttributeError: 'NoneType' object has no attribute 'clone'


Thanks for help




On Sun, Jul 1, 2012 at 9:53 PM, Thomas Orozco <g.orozco.tho...@gmail.com>wrote:

> Do you have jpeg support installed for PIL?
> Le 1 juil. 2012 18:13, "Nikhil Verma" <varma.nikhi...@gmail.com> a écrit :
>
>>
>> Hi All
>>
>> I am trying to add jpeg image in a ImageField. and it gives this error .
>> It is not allowing me to save the image.
>>
>> I have installed PIL and image other utilities.
>>
>> Upload a valid image. The file you uploaded was either not an image or a
>> corrupted image.
>>
>> Can anybody point what is missing ?
>>
>> Thanks in advance
>>
>>
>> --
>> Regards
>> Nikhil Verma
>> +91-958-273-3156
>>
>>  --
>> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Upload a valid image. The file you uploaded was either not an image or a corrupted image.

2012-07-01 Thread Nikhil Verma
Hi All

I am trying to add jpeg image in a ImageField. and it gives this error . It
is not allowing me to save the image.

I have installed PIL and image other utilities.

Upload a valid image. The file you uploaded was either not an image or a
corrupted image.

Can anybody point what is missing ?

Thanks in advance


-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-07-01 Thread Nikhil Verma
Great . +1

On Sun, Jul 1, 2012 at 1:12 PM, Àlex Pérez <alex.pe...@bebabum.com> wrote:

> +1
>
>
> 2012/7/1 s <saxix.r...@gmail.com>
>
>> Great
>> On Jun 30, 2012 6:10 PM, "Cal Leeming [Simplicity Media Ltd]" <
>> cal.leem...@simplicitymedialtd.co.uk> wrote:
>>
>>> Hi all,
>>>
>>> As some of you know, I did a live webcast last year (July 2011) on our
>>> LLG project, which explained how we overcome some of the problems
>>> associated with large data processing.
>>>
>>> After reviewing the video, I found that the sound quality was very
>>> poor, the slides weren't very well structured, and some of the information
>>> is now out of date (at the time it was 40mil rows, now we're dealing with
>>> 700+mil rows).
>>>
>>> Therefore, I'm considering doing another live webcast (except this time
>>> it'll be recorded+posted the next day, the stream will be available in
>>> 1080p, it'll be far better structured, and will only last 50 minutes).
>>>
>>> The topics I'd like to cover are:
>>>
>>> * Bulk data processing where bulk_insert() is still not viable (we went
>>> from 30 rows/sec to 8000 rows/sec on bulk data processing, whilst still
>>> using the ORM - no raw sql here!!)
>>> * Applying faux child/parent relationship when standard ORM is too
>>> expensive (allows for ORM approach without the cost)
>>> * Applying faux ORM read-only structure to legacy applications (allows
>>> ORM usage on schemas that weren't properly designed, and cannot be changed
>>> - for example, vendor software with no source code).
>>> * New Relic is beautiful, but expensive. Hear more about our plans to
>>> make an open source version.
>>> * Appropriate use cases for IAAS vs colo with SSDs.
>>> * Percona is amazing, some of the tips/tricks we've learned over.
>>>
>>> If you'd like to see this happen, please leave a reply in the thread -
>>> if enough people want this, then we'll do public vote for the scheduled
>>> date.
>>>
>>> Cheers
>>>
>>> Cal
>>>
>>> --
>>> 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.
>>
>
>
>
> --
> Alex Perez
> alex.pe...@bebabum.com
>
>  *bebabum* be successful
>
> c/ Còrsega 301-303, Àtic 2
> 08008 Barcelona
> http://www.bebabum.com
> http://www.facebook.com/bebabum
> http://twitter.com/bebabum
>
> This message is intended exclusively for its addressee and may contain
> information that is confidential and protected by professional privilege.
> If you are not the intended recipient you are hereby notified that any
> dissemination, copy or disclosure of this communication is strictly
> prohibited by law.
>
> Este mensaje se dirige exclusivamente a su destinatario y puede contener
> información privilegiada o confidencial. Si no es vd. el destinatario
> indicado,
> queda notificado que la utilización, divulgación y/o copia sin
> autorización
> está prohibida en virtud de la legislación vigente.
>
> Le informamos que los datos personales que facilite/ha facilitado pasarán a
> formar parte de un fichero responsabilidad de bebabum, S.L. y que tiene
> por finalidad gestionar las relaciones con usted.
> Tiene derecho al acceso, rectificación cancelación y oposición en nuestra
> oficina ubicada en c/ Còrsega 301-303, Àtic 2 de Barcelona o a la
> dirección de e-mail l...@bebabum.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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: invalid keyword argument for this function

2012-06-30 Thread Nikhil Verma
Yes its different.I was trying to say i tried your way and get rid of that
error.

Thanks

On Sat, Jun 30, 2012 at 8:56 PM, Sunny Nanda <snand...@gmail.com> wrote:

> This is a different error, and I don't see anything in the code snippet
> that might have caused this error (except if you are doing something in the
> Event model's save method)
>
> You would need to debug it further, and pinpoint the location of this
> error.
>
>
> On Saturday, June 30, 2012 8:37:34 PM UTC+5:30, Nikhil Verma wrote:
>
>> Yes its with the braces ")" also.
>>
>> On Sat, Jun 30, 2012 at 8:36 PM, Nikhil Verma 
>> <varma.nikhi...@gmail.com>wrote:
>>
>>> Hi Sunny
>>>
>>> I am trying with this
>>>
>>> *event_genre = event_form.cleaned_data['event_genre']
>>> event_public = event_form.cleaned_data['event_public']
>>> event_obj.save()*
>>> *category_obj.event_genre.add(event_genre),
>>>   category_obj.event_public.add(event_public*
>>>
>>>
>>> and getting this traceback:-
>>>
>>>
>>> Exception Type: TypeError at /event/createevent/
>>> Exception Value: int() argument must be a string or a number, not
>>> 'QuerySet'
>>>
>>>
>>> On Sat, Jun 30, 2012 at 8:30 PM, Sunny Nanda  wrote:
>>>
>>> Hi Nikhil,
>>>>
>>>> Just to reiterate :), you need to remove both event_public & even_genre 
>>>> while
>>>> creating the instance of the model, since both of them are M2M Fields. Take
>>>> a look at the example in my previous mail.
>>>>
>>>> If you are getting this exception somewhere else, please send that code
>>>> snippet so we might able to see the problem.
>>>>
>>>> Thanks,
>>>> Sandeep
>>>>
>>>>
>>>> On Saturday, June 30, 2012 8:14:28 PM UTC+5:30, Nikhil Verma wrote:
>>>>
>>>>> Hi Sunny
>>>>>
>>>>> I realized that earlier sunny, and cleared that defect but i get stuck
>>>>> into this error
>>>>>
>>>>> Traceback:
>>>>>
>>>>> Exception Type: TypeError at /event/createevent/
>>>>> Exception Value: 'event_genre' is an invalid keyword argument for this
>>>>> function
>>>>>
>>>>> Any help ?
>>>>>
>>>>> Thanks in advance
>>>>>
>>>>>
>>>>> On Sat, Jun 30, 2012 at 7:08 PM, Sunny Nanda  wrote:
>>>>>
>>>>> Hi Nikhil,
>>>>>>
>>>>>> You can not use an object's M2M field until it has been saved to the
>>>>>> db.
>>>>>> So, you would have to call the "save" method on the instance, or use
>>>>>> "create" method to create the instance.
>>>>>>
>>>>>>> category_obj = Category.objects.create(
>>>>>>>     type = categoryform.cleaned_data['**typ*
>>>>>>> ***e']
>>>>>>> )
>>>>>>> event_public = categoryform.cleaned_data['**eve
>>>>>>> nt_public']
>>>>>>> event_genre = categoryform.cleaned_data['**eve
>>>>>>> nt_genre']
>>>>>>> category_obj.event_genre.add(**event_genre),
>>>>>>> category_obj.event_public.add(**event_public),
>>>>>>> # No need to call save here
>>>>>>> # category_obj.save()
>>>>>>
>>>>>>
>>>>>> The reason behind this is that M2M Fields are represented
>>>>>> by intermediate tables with references to the two linked objects. If you
>>>>>> need to add a row in it, both referenced objects should already be saved 
>>>>>> in
>>>>>> the db with valid primary keys.
>>>>>>
>>>>>> H2H
>>>>>> -Sandeep
>>>>>>
>>>>>>
>>>>>> On Saturday, June 30, 2012 1:21:30 PM UTC+5:30, Nikhil Verma wrote:
>>>>>>>
>>>>>>> Hi All
>>>>>>>
>>>>>>> I have the following models like this :-
>>>>>>>
>>>>>>&g

Re: invalid keyword argument for this function

2012-06-30 Thread Nikhil Verma
Yes its with the braces ")" also.

On Sat, Jun 30, 2012 at 8:36 PM, Nikhil Verma <varma.nikhi...@gmail.com>wrote:

> Hi Sunny
>
> I am trying with this
>
> *event_genre = event_form.cleaned_data['event_genre']
> event_public = event_form.cleaned_data['event_public']
> event_obj.save()*
> *category_obj.event_genre.add(event_genre),
>   category_obj.event_public.add(event_public*
>
>
> and getting this traceback:-
>
>
> Exception Type: TypeError at /event/createevent/
> Exception Value: int() argument must be a string or a number, not
> 'QuerySet'
>
>
> On Sat, Jun 30, 2012 at 8:30 PM, Sunny Nanda <snand...@gmail.com> wrote:
>
>> Hi Nikhil,
>>
>> Just to reiterate :), you need to remove both event_public & even_genre while
>> creating the instance of the model, since both of them are M2M Fields. Take
>> a look at the example in my previous mail.
>>
>> If you are getting this exception somewhere else, please send that code
>> snippet so we might able to see the problem.
>>
>> Thanks,
>> Sandeep
>>
>>
>> On Saturday, June 30, 2012 8:14:28 PM UTC+5:30, Nikhil Verma wrote:
>>
>>> Hi Sunny
>>>
>>> I realized that earlier sunny, and cleared that defect but i get stuck
>>> into this error
>>>
>>> Traceback:
>>>
>>> Exception Type: TypeError at /event/createevent/
>>> Exception Value: 'event_genre' is an invalid keyword argument for this
>>> function
>>>
>>> Any help ?
>>>
>>> Thanks in advance
>>>
>>>
>>> On Sat, Jun 30, 2012 at 7:08 PM, Sunny Nanda  wrote:
>>>
>>> Hi Nikhil,
>>>>
>>>> You can not use an object's M2M field until it has been saved to the db.
>>>> So, you would have to call the "save" method on the instance, or use
>>>> "create" method to create the instance.
>>>>
>>>>> category_obj = Category.objects.create(
>>>>> type = categoryform.cleaned_data['**typ**
>>>>> e']
>>>>> )
>>>>> event_public = categoryform.cleaned_data['**eve**
>>>>> nt_public']
>>>>> event_genre = categoryform.cleaned_data['**eve**nt_genre']
>>>>> category_obj.event_genre.add(**e**vent_genre),
>>>>> category_obj.event_public.add(event_public),
>>>>> # No need to call save here
>>>>> # category_obj.save()
>>>>
>>>>
>>>> The reason behind this is that M2M Fields are represented
>>>> by intermediate tables with references to the two linked objects. If you
>>>> need to add a row in it, both referenced objects should already be saved in
>>>> the db with valid primary keys.
>>>>
>>>> H2H
>>>> -Sandeep
>>>>
>>>>
>>>> On Saturday, June 30, 2012 1:21:30 PM UTC+5:30, Nikhil Verma wrote:
>>>>>
>>>>> Hi All
>>>>>
>>>>> I have the following models like this :-
>>>>>
>>>>>
>>>>> class EventGenre(models.Model):
>>>>> genre_choices = models.CharField(max_length=**25**5)
>>>>>
>>>>> def __unicode__(self):
>>>>> return self.genre_choices
>>>>>
>>>>> class EventPublic(models.Model):
>>>>> choicelist = models.CharField(max_length=**25**5)
>>>>>
>>>>> def __unicode__(self):
>>>>> return self.choicelist
>>>>>
>>>>> class Category(models.Model):
>>>>> """
>>>>> Describes the Event Category
>>>>> """
>>>>>
>>>>> type = models.CharField(max_length=**20**,\
>>>>>   choices=EVENT_TYPE,\
>>>>>   help_text = "type of event"
>>>>>   )
>>>>> # Genre of event like classical,rock,pop ,indie etc
>>>>> event_genre = models.ManyToManyField(**EventGe**nre)
>>>>>
>>>>> # audience for this event like adults ,children etc
>>>>> event_public = models.M

Re: invalid keyword argument for this function

2012-06-30 Thread Nikhil Verma
Hi Sunny

I am trying with this

*event_genre = event_form.cleaned_data['event_genre']
event_public = event_form.cleaned_data['event_public']
event_obj.save()*
*category_obj.event_genre.add(event_genre),
  category_obj.event_public.add(event_public*


and getting this traceback:-

Exception Type: TypeError at /event/createevent/
Exception Value: int() argument must be a string or a number, not 'QuerySet'

On Sat, Jun 30, 2012 at 8:30 PM, Sunny Nanda <snand...@gmail.com> wrote:

> Hi Nikhil,
>
> Just to reiterate :), you need to remove both event_public & even_genre while
> creating the instance of the model, since both of them are M2M Fields. Take
> a look at the example in my previous mail.
>
> If you are getting this exception somewhere else, please send that code
> snippet so we might able to see the problem.
>
> Thanks,
> Sandeep
>
>
> On Saturday, June 30, 2012 8:14:28 PM UTC+5:30, Nikhil Verma wrote:
>
>> Hi Sunny
>>
>> I realized that earlier sunny, and cleared that defect but i get stuck
>> into this error
>>
>> Traceback:
>>
>> Exception Type: TypeError at /event/createevent/
>> Exception Value: 'event_genre' is an invalid keyword argument for this
>> function
>>
>> Any help ?
>>
>> Thanks in advance
>>
>>
>> On Sat, Jun 30, 2012 at 7:08 PM, Sunny Nanda  wrote:
>>
>> Hi Nikhil,
>>>
>>> You can not use an object's M2M field until it has been saved to the db.
>>> So, you would have to call the "save" method on the instance, or use
>>> "create" method to create the instance.
>>>
>>>> category_obj = Category.objects.create(
>>>> type = categoryform.cleaned_data['**typ**
>>>> e']
>>>> )
>>>> event_public = categoryform.cleaned_data['**eve**
>>>> nt_public']
>>>> event_genre = categoryform.cleaned_data['**eve**nt_genre']
>>>> category_obj.event_genre.add(**e**vent_genre),
>>>> category_obj.event_public.add(event_public),
>>>> # No need to call save here
>>>> # category_obj.save()
>>>
>>>
>>> The reason behind this is that M2M Fields are represented
>>> by intermediate tables with references to the two linked objects. If you
>>> need to add a row in it, both referenced objects should already be saved in
>>> the db with valid primary keys.
>>>
>>> H2H
>>> -Sandeep
>>>
>>>
>>> On Saturday, June 30, 2012 1:21:30 PM UTC+5:30, Nikhil Verma wrote:
>>>>
>>>> Hi All
>>>>
>>>> I have the following models like this :-
>>>>
>>>>
>>>> class EventGenre(models.Model):
>>>> genre_choices = models.CharField(max_length=**25**5)
>>>>
>>>> def __unicode__(self):
>>>> return self.genre_choices
>>>>
>>>> class EventPublic(models.Model):
>>>> choicelist = models.CharField(max_length=**25**5)
>>>>
>>>> def __unicode__(self):
>>>> return self.choicelist
>>>>
>>>> class Category(models.Model):
>>>> """
>>>> Describes the Event Category
>>>> """
>>>>
>>>> type = models.CharField(max_length=**20**,\
>>>>   choices=EVENT_TYPE,\
>>>>   help_text = "type of event"
>>>>   )
>>>> # Genre of event like classical,rock,pop ,indie etc
>>>> event_genre = models.ManyToManyField(**EventGe**nre)
>>>>
>>>> # audience for this event like adults ,children etc
>>>> event_public = models.ManyToManyField(**EventPu**blic)
>>>>
>>>> def __unicode__(self):
>>>> return self.type
>>>>
>>>> This is my category form
>>>>
>>>> class CategoryForm(forms.Form):
>>>> type = forms.CharField(max_length=80, \
>>>>widget=RadioSelect(choices=**EVE**NT_TYPE)
>>>>)
>>>> event_genre = forms.**ModelMultipleChoiceField**(
>>>> queryset = EventGenre.objects.all(),
>>>>

Re: invalid keyword argument for this function

2012-06-30 Thread Nikhil Verma
Hi Sunny

I realized that earlier sunny, and cleared that defect but i get stuck into
this error

Traceback:

Exception Type: TypeError at /event/createevent/
Exception Value: 'event_genre' is an invalid keyword argument for this
function

Any help ?

Thanks in advance


On Sat, Jun 30, 2012 at 7:08 PM, Sunny Nanda <snand...@gmail.com> wrote:

> Hi Nikhil,
>
> You can not use an object's M2M field until it has been saved to the db.
> So, you would have to call the "save" method on the instance, or use
> "create" method to create the instance.
>
>> category_obj = Category.objects.create(
>> type = categoryform.cleaned_data['**type']
>> )
>> event_public = categoryform.cleaned_data['**event_public']
>> event_genre = categoryform.cleaned_data['**event_genre']
>> category_obj.event_genre.add(**event_genre),
>> category_obj.event_public.add(**event_public),
>> # No need to call save here
>> # category_obj.save()
>
>
> The reason behind this is that M2M Fields are represented
> by intermediate tables with references to the two linked objects. If you
> need to add a row in it, both referenced objects should already be saved in
> the db with valid primary keys.
>
> H2H
> -Sandeep
>
>
> On Saturday, June 30, 2012 1:21:30 PM UTC+5:30, Nikhil Verma wrote:
>>
>> Hi All
>>
>> I have the following models like this :-
>>
>>
>> class EventGenre(models.Model):
>> genre_choices = models.CharField(max_length=**255)
>>
>> def __unicode__(self):
>> return self.genre_choices
>>
>> class EventPublic(models.Model):
>> choicelist = models.CharField(max_length=**255)
>>
>> def __unicode__(self):
>> return self.choicelist
>>
>> class Category(models.Model):
>> """
>> Describes the Event Category
>> """
>>
>> type = models.CharField(max_length=**20,\
>>   **choices=EVENT_TYPE,\
>>   **help_text = "type of event"
>>   **)
>> # Genre of event like classical,rock,pop ,indie etc
>> event_genre = models.ManyToManyField(**EventGenre)
>>
>> # audience for this event like adults ,children etc
>> event_public = models.ManyToManyField(**EventPublic)
>>
>> def __unicode__(self):
>> return self.type
>>
>> This is my category form
>>
>> class CategoryForm(forms.Form):
>> type = forms.CharField(max_length=80, \
>>widget=RadioSelect(choices=**EVENT_TYPE)
>>)
>> event_genre = forms.**ModelMultipleChoiceField(
>> queryset = EventGenre.objects.all(),
>> widget=CheckboxSelectMultiple,
>> required=False
>> )
>> event_public = forms.**ModelMultipleChoiceField(
>> queryset = EventPublic.objects.all(),**
>>
>> widget=CheckboxSelectMultiple,
>> required=False
>> )
>>
>> This is my views.py
>>
>> def eventcreation(request):
>> if request.method == "POST":
>> event_form = EventForm(request.POST,**request.FILES,prefix="**
>> eventform")
>> categoryform = CategoryForm(request.POST)
>> if event_form.is_valid():
>> event_obj = Event(
>> venue_name = event_form.cleaned_data['**venue_name'],
>> date_created = event_form.cleaned_data['**event_start_date'],
>> date_completed = event_form.cleaned_data['**event_end_date'],
>> event_ticket_price = event_form.cleaned_data['**
>> event_ticket_price'],
>> eventwebsite = event_form.cleaned_data['**eventwebsite'],
>> keyword = event_form.cleaned_data['**keyword'],
>> description = event_form.cleaned_data['**description'],
>> status = event_form.cleaned_data['**status'],
>> event_poster = event_form.cleaned_data['**event_poster']
>> )
>> if categoryform.is_valid():
>> category_obj = Category(
>> type = categoryform.cleaned_data['**type'],
>> event_public = categoryform.c

Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Nikhil Verma
Thanks for the help guys.

On Fri, Jun 29, 2012 at 11:37 AM, Sunny Nanda <snand...@gmail.com> wrote:

> One way to store such information can be like this:
> Create a model "Day". This will hold entries for each day i.e. from Monday
> till Sunday
> In the UserProfile model, create a ManyToMany relation to the above
> defined Day model through an intermediate table (say WorkingHours) which
> can hold the "from" and "to" time.
>
> Partial example below:
>
> class UserProfile(models.Model):
>> working_hours = models.ManyToManyField("Day", through="WorkingHours")
>>
>> class WorkingHours(models.Model)
>> profile = models.ForeignKey("UserProfile")
>> day = models.ForeignKey("Day")
>> from_time = models.**TimeField()
>> to_time = models.**TimeField()
>>
>
> While creating the forms, take input from the user for the WorkingHours
> model. This way, the days of work will not be hardcoded, and user can
> select mutiple choices.
>
> Regards,
> Sandeep
>
>
>
> On Friday, June 29, 2012 10:16:47 AM UTC+5:30, Nikhil Verma wrote:
>>
>>
>> Hi
>>
>> I am developing an event app which has users who publish events , other
>> users also.
>> Now users have their profile info for which i have made a very common
>> UserProfile Model with all the necessary details in it.
>>
>> I have a requirement where in UserProfile model i need to display a field
>> institue_hours_of_operation( no. of hours that an institute works)
>>
>>
>> class UserProfile(models.Model):
>> user = models.ForeignKey(User, blank=True, null=True, unique=True)
>> first_name = models.CharField(max_length=**30, blank=True)
>> last_name = models.CharField(max_length=**30, blank=True)
>> gender = models.CharField(max_length=1, choices=GENDER_CHOICES,
>> blank=True)
>> birth_date = models.DateField(auto_now_add=**True)
>> street_address = models.CharField(max_length=**75, blank=True)
>> city = models.CharField(max_length=**30, blank=True)
>> zip_code = models.IntegerField(max_**length=7, blank=True, null=True)
>> country = models.CharField(max_length=**30, blank=True)
>> mobile = models.CharField(max_length=**15, blank=True)
>> home_phone = models.CharField(max_length=**15, blank=True)
>> primary_email = models.EmailField(max_length=**60, blank=True)
>> secondary_email = models.EmailField(max_length=**60, blank=True)
>> institution_name = models.CharField(max_length=**
>> 100,blank=True,null=True)
>> institution_website = models.CharField(max_length=**
>> 100,blank=True,null=True)
>>
>>
>> # Field to be added
>>
>> It will be displayed in html like this
>>
>> Insitutue hour of operation :   Monday  9.00 - 17.00 (Monday will be
>> hardcoded,Time will be filled by user)
>>   **Tuesday 9.00 - 17.00
>> (Monday will be hardcoded,Time will be filled by user)
>>
>>   ** and so on
>>
>> # Note the weekdays like monday,  tuesday they are all hardcoded as
>> requirement but i don't want that to be hardcoded.
>> Also i am using a django forms  to display this.
>>
>>
>> How can i design this form field as well in models or What should be the
>> type of this field both in models and forms such that weekdays remain
>> dynamic(i can simply generate them from loop) and the user can fill the
>> time  and when he hits submit it will get saved.
>>
>>
>> Thanks in advance.
>>
>>
>>
>> --
>> Regards
>> Nikhil Verma
>> +91-958-273-3156
>>
>>  --
> 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/-/N2ArPbWtQmYJ.
>
> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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 manage range of hours in models and forms in django1.4

2012-06-29 Thread Nikhil Verma
Hi Jon

Yes it is the count of the hours.They will enter in the following manner "-

Monday : 0900-1800, Tuesday and so on ... This will be entered by the user
who is filling the form.

Now the text Moday(weekdays can be hardcoded but i personally don't want.)
Now if you see this is a simple CharField where the user enters details for
the number_of_hours.
So i want to know what type of model field should i create CharField or
Time Field.

If i   go for CharField it will simply save the details like 0900-1800. So
if i need to know how many hours that particular person is available for
work then how will subtract that from CharField.

So i need help to know what exactly the field i should create such that it
satisfies the template look and backened queries also.



On Fri, Jun 29, 2012 at 2:18 PM, Jon Black <jon_bl...@mm.st> wrote:

>  I understand that institue_hours_of_operation is a count of the hours the
> user has worked, is that correct? If so, I suppose you just need to count
> the hours with each form submition and add that to the current
> institue_hours_of_operation value. You can do that logic in a few places.
> In class-based views, I tend to put it in form_valid().
>
>  Apologies if I've misunderstood :)
>
>  --
>  Jon Black
>  www.jonblack.org
>
>
>  On Fri, Jun 29, 2012, at 10:16, Nikhil Verma wrote:
>
>
>  Hi
>
> I am developing an event app which has users who publish events , other
> users also.
> Now users have their profile info for which i have made a very common
> UserProfile Model with all the necessary details in it.
>
> I have a requirement where in UserProfile model i need to display a field
> institue_hours_of_operation( no. of hours that an institute works)
>
>
> class UserProfile(models.Model):
> user = models.ForeignKey(User, blank=True, null=True, unique=True)
> first_name = models.CharField(max_length=30, blank=True)
> last_name = models.CharField(max_length=30, blank=True)
> gender = models.CharField(max_length=1, choices=GENDER_CHOICES,
> blank=True)
> birth_date = models.DateField(auto_now_add=True)
> street_address = models.CharField(max_length=75, blank=True)
> city = models.CharField(max_length=30, blank=True)
> zip_code = models.IntegerField(max_length=7, blank=True, null=True)
> country = models.CharField(max_length=30, blank=True)
> mobile = models.CharField(max_length=15, blank=True)
> home_phone = models.CharField(max_length=15, blank=True)
> primary_email = models.EmailField(max_length=60, blank=True)
> secondary_email = models.EmailField(max_length=60, blank=True)
> institution_name =
> models.CharField(max_length=100,blank=True,null=True)
> institution_website =
> models.CharField(max_length=100,blank=True,null=True)
>
>
> # Field to be added
>
> It will be displayed in html like this
>
> Insitutue hour of operation :   Monday  9.00 - 17.00 (Monday will be
> hardcoded,Time will be filled by user)
>   Tuesday 9.00 - 17.00
> (Monday will be hardcoded,Time will be filled by user)
>
>and so on
>
> # Note the weekdays like monday,  tuesday they are all hardcoded as
> requirement but i don't want that to be hardcoded.
> Also i am using a django forms  to display this.
>
>
> How can i design this form field as well in models or What should be the
> type of this field both in models and forms such that weekdays remain
> dynamic(i can simply generate them from loop) and the user can fill the
> time  and when he hits submit it will get saved.
>
>
> Thanks in advance.
>
>
>
> --
> Regards
> Nikhil Verma
> +91-958-273-3156
>
>
> --
> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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 to manage range of hours in models and forms in django1.4

2012-06-28 Thread Nikhil Verma
Hi

I am developing an event app which has users who publish events , other
users also.
Now users have their profile info for which i have made a very common
UserProfile Model with all the necessary details in it.

I have a requirement where in UserProfile model i need to display a field
institue_hours_of_operation( no. of hours that an institute works)


class UserProfile(models.Model):
user = models.ForeignKey(User, blank=True, null=True, unique=True)
first_name = models.CharField(max_length=30, blank=True)
last_name = models.CharField(max_length=30, blank=True)
gender = models.CharField(max_length=1, choices=GENDER_CHOICES,
blank=True)
birth_date = models.DateField(auto_now_add=True)
street_address = models.CharField(max_length=75, blank=True)
city = models.CharField(max_length=30, blank=True)
zip_code = models.IntegerField(max_length=7, blank=True, null=True)
country = models.CharField(max_length=30, blank=True)
mobile = models.CharField(max_length=15, blank=True)
home_phone = models.CharField(max_length=15, blank=True)
primary_email = models.EmailField(max_length=60, blank=True)
secondary_email = models.EmailField(max_length=60, blank=True)
institution_name = models.CharField(max_length=100,blank=True,null=True)
institution_website =
models.CharField(max_length=100,blank=True,null=True)


# Field to be added

It will be displayed in html like this

Insitutue hour of operation :   Monday  9.00 - 17.00 (Monday will be
hardcoded,Time will be filled by user)
  Tuesday 9.00 - 17.00 (Monday
will be hardcoded,Time will be filled by user)

   and so on

# Note the weekdays like monday,  tuesday they are all hardcoded as
requirement but i don't want that to be hardcoded.
Also i am using a django forms  to display this.


How can i design this form field as well in models or What should be the
type of this field both in models and forms such that weekdays remain
dynamic(i can simply generate them from loop) and the user can fill the
time  and when he hits submit it will get saved.


Thanks in advance.



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Update database with model changes

2012-06-07 Thread Nikhil Verma
If you mean you added a field after creating a model class table you need
to generate the sql statement for the new field only( for hint , django
will generate automatically if you do python manage.py sql appname and see
the sql) in a file and execute that file .

Let say you have xyz.sql just run that file.The table/database will be
updated.
I hope this info might help you !

On Thu, Jun 7, 2012 at 11:35 PM, Kevin Anthony <kevin.s.anth...@gmail.com>wrote:

> Use south
>
> Kevin
> Please excuse brevity, sent from phone
> On Jun 7, 2012 2:05 PM, "Robert Steckroth" <robertsteckr...@gmail.com>
> wrote:
>
>> Hey Gang, is there a way to update the database with a syncdb or
>> other command after a model has been changed? I added a field
>> the the model after the syncdb.
>>
>>
>> --
>> Bust0ut, Surgemcgee: Systems Engineer ---
>> PBDefence.com
>> BudTVNetwork.com
>> RadioWeedShow.com
>> "Bringing entertainment to Unix"
>>
>> --
>> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: global name 'content' is not defined

2012-05-27 Thread Nikhil Verma
Hi

>From the traceback the error is in :-

def view_page(request, page_name):
   try:
   page = Page.objects.get(pk=page_name)
   except Page.DoesNotExist:
   return render_to_response("create.
>
> html",{"page_name":page_name})
>return render_to_response("view.html", {"page_name":page_name,
> "content":content},context_instance=RequestContext(request))
>

Before looking further make sure everything is imported correctly.

Now, It is not able recognize content,  what is content ?

You should do content = page.content and then assign  a key named 'content'
: content just like you had.

Page is a class and content,name are its attributes.

so when you do this :-

page = Page.objects.get(pk=page_name)

# You are making a query from the Page table that will return something ,
page_name you are already passing it as an argument (don't know how) that's
why it is not throwing an error but for content , it is an entity/attribute
of page .

So make an object of that class Page and then access its attributes.

I am also not an expert in django but i think this info might help you.


On Sun, May 27, 2012 at 2:28 PM, Ali Shaikh <shaikht...@gmail.com> wrote:

>  'model.py`
>   from django.db import models
>
>   class Page(models.Model):
>name = models.CharField(max_length=20, primary_key=True)
>content = models.TextField(blank=True)
>
>   # Create your models here.
>
> `view.py`
> from wiki.models import Page
> from django.shortcuts import render_to_response
> from django.http import HttpResponseRedirect, HttpResponse
> from django.shortcuts import get_object_or_404, render_to_response
> from django.core.urlresolvers import reverse
> from django.template import RequestContext
> from django.shortcuts import render_to_response
> from django.core.context_processors import csrf
>
>
> def view_page(request, page_name):
>try:
>page = Page.objects.get(pk=page_name)
>except Page.DoesNotExist:
>return
> render_to_response("create.html",{"page_name":page_name})
>return render_to_response("view.html", {"page_name":page_name,
> "content":content},context_instance=RequestContext(request))
>
> def edit_page(request, page_name):
>try:
>page = Page.objects.get(pk=page_name)
>content= page.contents
>except Page.DoesNotExist:
>content= ""
>return render_to_response("edit.html", {"page_name":page_name,
> "content":content},context_instance=RequestContext(request))
>
> def save_page(request, page_name):
>content= request.POST["content"]
>try:
>page = Page.objects.get(pk=page_name)
>page.content= content
>except Page.DoesNotExist:
>page = Page(name=page_name,content=content)
>page.save()
>return HttpResponseRedirect("/wikicamp/" + page_name + "/")
>
>Traceback
>
>
> Environment:
> Request Method: GET
> Request URL:
>
> Django Version: 1.4
> Python Version: 2.6.6
> Installed Applications:
> ('django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'wiki')
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware')
>
>
> Traceback:
>
> enter code here
>
> File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> base.py" in get_response
>  111. response = callback(request,
> *callback_args, **callback_kwargs)
> File "/home/tanveer/djcode/wikicamp/wiki/views.py" in view_page
>  16.   return render_to_response("view.html", {"page_name":page_name,
> "content":content},context_instance=RequestContext(request))
>
> Exception Type: NameError at /wikicamp/start/
> Exception Value: global name 'content' is not defined
>
>
> PLs help..:(
>
> --
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Store base64 data in database with imagefield ?

2012-05-15 Thread Nikhil Verma
Hi

I had similar situation where a textfield (which was made a markup editor
by applying css and all) was given where people come in write anything and
discuss about their topics; you can imagine like a forum.
So i made some regular expressions to allow videos to show in an iframe and
image to open up in a fancy box.
Your case is similar to my case where image has to be shown in a fancy box
when a user clicks on that.


So i had to use jquery like this:-

Step 1) Write the importing scripts line in base.html

Step 2) Textfield which i was showing  on templates put a class and then
call this jquery. Luckily that solved my problem

$(document).ready(function(){
$("a.fancybox").fancybox({type:'image'});
});
 

Hope that helps you.

On Tue, May 15, 2012 at 5:25 PM, bussiere bussiere <bussi...@gmail.com>wrote:

> Does anyone tried to store only Base64 info in databse of an image
> instead of a file with django image field ?
>
> Do you have any idea how to do it ?
>
> Or some hints to give me ?
>
> regards and thanks
> Bussiere
>
>
>
> "Les nouvelles technologies offrent pleins de nouvelles possibilités,
> pleins de possibilités d'erreurs surtout en fait."
> insurance.aes256 : http://goo.gl/gHyAY
> -BEGIN PGP PUBLIC KEY BLOCK-
> Version: GnuPG v1.2.1 (MingW32) - WinPT 0.7.96rc1
>
> mQGiBE9sjdsRBADsY+DaDgj+pDuGLNVL6Dc+ghCxaEBK+9nwBvKPGIUocz13V42P
> 5Jn/NJ9zRgZNdg5XbhohN2ltas8Nr09rrRQXbBk8zjCg/Qr0a4LmfA3j128SwCfZ
> aTe5zlo/WSSuGv6kWGe/KZrLmiQoZRTDbZzqWyZxuJRkcpgsZc+jYRXJHwCgualT
> LpC23Ja3plM6J6noFaqAlMUEAKZGDadSS/BW4gckw9XqSHRex7/XyWU4sqVQlhMy
> 5DEIba7H8cU6grww+p/cYa3OCocv5Mycf6MbWDCPrtsG0X08u8PgEaE29BsLIgSm
> JF6r8y4Rgwj5xyCMTaxql82S+tZHyScpAoQ0a+xlTwxMZMuwK9p6b7oipXHL+UPN
> sDfkBACoYLS4PQPFotqWI96j83NNLwEumUzA6Rqyas8w6Xwr51quA65y/0nBmMmp
> l58tKN7eyc5+bIpRX5bGG6ktCUHnfzk9uvnG7peilWzYT6+AJ3gbBgMGLBPByJBN
> NH+nLjzsh4PzIxuSHLMiK5FkDNE2B95kaahIg42SQPT80LyvDLQlYnVzc2llcmVf
> cHJpdmF0ZSA8YnVzc2llcmVAZ21haWwuY29tPohZBBMRAgAZBQJPbI3bBAsHAwID
> FQIDAxYCAQIeAQIXgAAKCRAYpzZWoPP7b0h0AJ4n9feBF2FH4JUGhLU3XL3eIrOX
> 9gCfZbN4JHYl/nRLL4uHrceRUk1M9Pm5Ac0ET2yN3hAHAK5MypLMT50yklt1n/pQ
> MjrFXuvM9IQvVyQemHMUBqKqxPTVMJLn86mR5mTLMqs+WVAqei8GTsQeSSvHyIbk
> 8RvYrKY7aK2RVZUV1dHQ6PII0w3BI5C0L9GM/UyIq0VRXTW6zjp9hS/xgn5SrQad
> VIdGQKFVJa9h5/AzgjseARMQRkTQA/xX5/WmHxXaXUPhGxCeFsoqs53UFz1rkHYx
> mus2WiD0gHbJ58DiMlVmupeNumi4e9wa+mYuW4qGwjzsQn9ZFNdoiUFzQrqZa6o+
> Son+yZpGe/H9VidrWR5LhwD7AAMGBv9bhswvwpQ23X0kGItv7/jHVr/RJui7FAXY
> mOM4WAoUv/5ttPHf8OifWmeUDPlzm4txvR5a7t4hhVDehek1J7FEVvfG+ffcHiPP
> kkFaUv2EgrXziozt/Vkr2nngsKO5FpRJe9GSqn68uZirhwbkHSKX6LPNFTWSYR3E
> fefnsCaP82OJDBFGFMg2aMsz9QL85bg58fgHU972kLTePXUVAh3gaxb6qpjwZt2b
> yrCGJ/rnmIc/IWH8TJtHI5Yf3Abx2vlFTtzRH0CwVXuO0msjcfRS8NSm/ih5
> 0ssElxKU6IhGBBgRAgAGBQJPbI3eAAoJEBinNlag8/tvoBEAn2Yqu0UFC5OSjD1Y
> JQ00FFjNVestAJ0XctcbmhKaFuQ46SccW8C2JDG/xA==
> =+VZi
> -END PGP PUBLIC KEY BLOCK-
>
> --
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Modify __unicode__

2012-05-02 Thread Nikhil Verma
Hi All

In models.py my table structure is :-

class ABC(models.Model):
name = models.CharField(max_length=80,blank=True,null=True)
date_created = models.DateTimeField(blank=True,null=True)

def __unicode__(self):
return "%s %s" % (self.name, self.date_created)


Let say my first entry is :-
name = django
date_created = 2012-05-02 # it will look like this datetime.datetime(2012,
5, 2, 15, 42, 24)

I want to modify this ABC(__unicode__ method)  object in such a way that
whenever i call this object from forms
like this :-

forms.py

efg = forms.ModelChoiceField(queryset= ABC.objects.all())

The dropdown created above should have values like this:-

1) django Wednesday PM 2 May # Modify dateTimeField which retuen day of
week AM or PM and then day and name of month
2) django1 Wednesday PM 2 May
.
.
.
.
and so on ..

How can i modify the __unicode__ method to achieve this ?

If there is other ways to achieve this that involves changing the table
structure i won't mind.

Thanks



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Display Video inside a Text field -Django Templates

2012-04-28 Thread Nikhil Verma
Hi Pratik

Thanks for the reply

{{ post.user.forum_profile.signature|safe }} contains complete text
including the urls of youtube and other links.

Only youtube links will show video(i have made them displayed in
iframe) and other will open in a new tab.

Currently this task have been achieved by jquery with lots of pain
because i was not able to find any good solution.

Do you think jquery is the write approach.

Can you give some links how do we use youtube api integration with
django templates



On Sun, Apr 29, 2012 at 1:09 AM, Pratik Mandrekar <pratikmandre...@gmail.com
> wrote:

> Hi,
>
> You will need to identify the video url in the post, then depending on
> the url try do some processing, like getting the title or thumbnail
> and render it back to your template. If you want to play the video,
> you will need a video player. Eg. If it is a youtube link, then embed
> the youtube player and use youtube api's if needed to render and load.
>
>
> Pratik Mandrekar
>
> On Apr 28, 7:56 am, Nikhil Verma <varma.nikhi...@gmail.com> wrote:
> > Hi All
> >
> > I have a TextField to which after applying css it looks like a markup
> > editor where i write some text, paste file links upload image etc.Now  if
> > the user paste a video link to that editor the video should display inide
> > that editor/TextField like in other websites eg: facebook(On click Video
> > link it displays on the same page).
> >
> > Can anybody tell me the steps how can i play the video inside a
> TextField ?
> >
> > I searched lot about iframe.In my template i have the textfield in which
> > the user paste the link of video saves it and it displays.Now if the user
> > click on that video link the video should display inside  that markup
> > editor/textfield.
> >
> > My views :-
> >
> > def edit_post(request, post_id):
> >
> > from djangobb_forum.templatetags.forum_extras import
> forum_editable_by
> >
> > post = get_object_or_404(Post, pk=post_id)
> > topic = post.topic
> > if not forum_editable_by(post, request.user):
> > return HttpResponseRedirect(post.get_absolute_url())
> > form = build_form(EditPostForm, request, topic=topic, instance=post)
> > if form.is_valid():
> > post = form.save(commit=False)
> > post.updated_by = request.user
> > post.save()
> > return HttpResponseRedirect(post.get_absolute_url())
> >
> > return {'form': form,
> > 'post': post,
> >}
> >
> > Template
> >
> > {% if post.user.forum_profile.signature %}
> >
> > 
> > 
> >
> > {{ post.user.forum_profile.signature|safe }} # This is the textfield.
> >
> > 
> >
> > {% endif %}
> >
> > --
> > Regards
> > Nikhil Verma
> > +91-958-273-3156
>
> --
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Display Video inside a Text field -Django Templates

2012-04-27 Thread Nikhil Verma
Hi All

I have a TextField to which after applying css it looks like a markup
editor where i write some text, paste file links upload image etc.Now  if
the user paste a video link to that editor the video should display inide
that editor/TextField like in other websites eg: facebook(On click Video
link it displays on the same page).

Can anybody tell me the steps how can i play the video inside a TextField ?

I searched lot about iframe.In my template i have the textfield in which
the user paste the link of video saves it and it displays.Now if the user
click on that video link the video should display inside  that markup
editor/textfield.

My views :-

def edit_post(request, post_id):

from djangobb_forum.templatetags.forum_extras import forum_editable_by

post = get_object_or_404(Post, pk=post_id)
topic = post.topic
if not forum_editable_by(post, request.user):
return HttpResponseRedirect(post.get_absolute_url())
form = build_form(EditPostForm, request, topic=topic, instance=post)
if form.is_valid():
post = form.save(commit=False)
post.updated_by = request.user
post.save()
return HttpResponseRedirect(post.get_absolute_url())

return {'form': form,
'post': post,
   }


Template


{% if post.user.forum_profile.signature %}




{{ post.user.forum_profile.signature|safe }} # This is the textfield.



{% endif %}


-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Increased number of columns in admin/change_list page leads to cross page boundary

2012-04-18 Thread Nikhil Verma
HI All


I have an app whose admin used to contain 10 columns but now as the
requirement grows i have 18 columns which leads to disturbance in the GUI
of the change_list
page. The last 2-3 columns are getting to extreme right by which the look
gets spoiled. Moreover i have to scroll the page in right direction to see
what those columns contain.

Is there any django way to solve this problem. Like we have class Media to
alter the individual widget in admin ? If not what the best way ?

Thanks in advance !

-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Python Developer

2012-04-02 Thread Nikhil Verma
Hi Monali

I have 1.5 years of Python ,Django ,Jquery Experience.
You can take a look at www.out-adventures.com and www.careprep.com to get
an idea of my work.
Hope to hear from you !

Thanks

On Mon, Apr 2, 2012 at 11:35 PM, Flex Monali <flexmon...@gmail.com> wrote:

> Please let me know if any one is interested in below jobs.
>
> Please ask them to contact me on 408-845-9400 Ext 109 or email
> mon...@flextoninc.com
>
>
> Please let me know your interest in below requirement.
>
> Title: Python Developer
> Approx Duration: 6 months+/Fulltime
> Terms: Contract CTH
> Location: San Jose
>
> Primary Job
> Responsibilities:
> We are looking for exceptional senior software engineers that have a
> strong command of web application programming in a Linux environment.
> They would be working within a small engineering team to:
> •   Implement new web tools using Python/Django in a Linux/Apache
> environment with high quality.
> •   Enhance current product capabilities for better performance,
> scalability and maintainability.
> •   Create detailed technical design documents and participate in
> design
> reviews.
> •   Play an active role in implementing and providing feedback on new
> processes
> •   Provide technical guidance and assistance to other software
> engineers.
> •   Candidate should be  detail-oriented, organized, proactive, and
> able
> to work on multiple projects/tasks simultaneously
> Job Requirements:
> •   Bachelors Degree in Computer Science is required and MSCS
> preferred.
> •   Targeting engineers with 2 to 5 years of work experience.
> •   Strong background in Python / Django, with emphasis on Python’s web
> capabilities
> •   At least 1 year of experience with Linux web development and
> deployment.
> •   Proficient in JavaScript, jQuery, CSS, HTML. (Around 1year exp will
> also do)
> •   Competent level C++ skills with demonstrated ability to resolve
> complex problems is a plus
> •   Knowledge of git, SOA, database performance, PHP, UML, and Agile
> programming practices is a plus.
> •   Strong verbal and written communication skills
>
> Location –  Mountain View, CA.
> Duration – Fulltime
> Salary-DOE
> EXP-1 to 10 yrs.
>
> Expert Expert in Python!!
>
> Expertise in Python a strong plus.
> Experience designing APIs preferred.
> Worked on Data base side preferred so that they can acess the data
> base.
>
>
> Thanks & Best Regards,
> Monali
> Technical Resource Manager
> Flexton Inc .
> Tel: 408-845-9400 Ext :109
> Fax:408-890-4619
> Email: mon...@flextoninc.com
> URL: www.flextoninc.com  ||
> http://www.linkedin.com/pub/monali-bhoi/29/431/45
>
> For many years, Flexton Inc. has successfully served the technology
> needs of several customers from diverse industries and locations
> throughout North America. Flexton has a reputation for addressing its
> clients' complex challenges with business understanding and innovative
> technical solutions. Flexton specializes in full-lifecycle project
> efforts conducted in strategic partnership with some of the world's
> most prominent companies.We are always in search for great talents in
> the IT professional world & look for the best opportunity for you to
> grow to the next level. We are here to understand your background,
> your past experience & also give you the opportunity to learn new
> technologies.
>
> --
> We respect your email and Internet privacy. If you have received this
> e-mail in error or wish to be removed from our e-mail list, please
> write us with "Remove" in subject line and your ID will be removed
> from our mailing list immediately. This email contains confidential
> information that is legally protected. If you are not the intended
> recipient any disclosure or any action in reliance on the contents is
> strictly prohibited.
>
>
>
>
>
>
>
> --
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

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



sorting a list of objects when objects is returning two fields

2012-04-01 Thread Nikhil Verma
Hi All

I have a model structure like this :-

class Visit(Model):
patient = models.ForeignKey(Patient)
... and so on 
topics  = models.ManyToManyField(Topic,
limit_choices_to={'reporting':False})
research_protocol   =
models.ManyToManyField(ResearchProtocol,blank=True)
history_log = JSONField(blank=True)


...and so on .
class Meta:
ordering = ("-date_created",)

def __unicode__(self):
result = """Visit id:%s pt:%s""" % (self.id, self.patient.id)
return result

  So the objects looks like this  


Now at some table i am making a query that returns me list of objects like
this :-

research_obj = ResearchProtocol.objects.get(id=id)
# You can see research_protocol is ManyToManyField in the above model.
visit_ids = research_obj.visit_set.all()

[ , , , ]

Now i want to sort this list of objects in such a manner that i get this
new sorted list :-

*[ , , ,, ]*

You can see the pt is also getting sorted and Visit Id is also getting
sorted .

I am using this :-

ordered_total_visit_ids = sorted(total_visit_ids, key=lambda x: x.patient,
reverse=False)

Thanks for help in advance.


-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: django-admin change form page validation

2012-03-31 Thread Nikhil Verma
Hi

I did not override response_change method but i override clean method by
creating form in admin like this :-

class InterviewAdminForm(forms.ModelForm):
class Meta:
model = Interview

def clean(self, *args, **kwargs):
cleaned_data = super(InterviewAdminForm, self).clean(*args,
**kwargs)

if self.cleaned_data['interview_type'] == "default" \
and self.cleaned_data['Revisit'] == True:
raise forms.ValidationError({'interview_type': ["error
message",]})
else:
return cleaned_data

It displays the ValidationError message on the admin page but somehow i
want show that error just above the interview_type field .
How can i achieve this ?

This method  works pretty fine. I want to know when we use response_change
method ?


Thanks in advance .
On Sat, Mar 31, 2012 at 10:50 AM, dummyman dummyman <tempo...@gmail.com>wrote:

> ok. in admin,.py file
>
>
> override the response_change method
>
> def response_change(self,request,obj)
>
> obj is the handler
>
> so u can check using obj.field_name and take approp action
>
>
> On Sat, Mar 31, 2012 at 10:34 AM, Nikhil Verma 
> <varma.nikhi...@gmail.com>wrote:
>
>> Hi
>>
>> I understand that but the problem is its a condition which i have to add
>> if the revisit checkbox is selected and then in interview_type dropdown
>> None option is selected ; after pressing save it should throw an error .
>>
>> None is an option in the dropdown . It is not blank=True and null =True
>>
>> INTERVIEW_TYPES = (
>>
>> ('default', 'None'),
>> ('Paired Visit','Paired Visit'),
>> ('Time Series', 'Time Series'),
>>
>> ),
>>
>> interview_type will show choices with dropdown 1) None 2) Paired Visit 3)
>> Time Series
>>
>>
>> On Sat, Mar 31, 2012 at 10:28 AM, dummyman dummyman 
>> <tempo...@gmail.com>wrote:
>>
>>> Hi
>>>
>>> unless u dont specify blank=True or null = True in modes for d
>>> corresponding fields, django will throw an errror if u don fill up the field
>>>
>>> On Sat, Mar 31, 2012 at 9:25 AM, Nikhil Verma 
>>> <varma.nikhi...@gmail.com>wrote:
>>>
>>>> Hi All
>>>>
>>>> How can i apply validation in admin on various fields when they are
>>>> dependent on each other ?
>>>>
>>>> e.g. Let say in i have a  Field A(BooleanField)  and Field B
>>>> (CharField) what i want to do is if in admin user select the Field
>>>> A(checkbox) and does not enter anything in Field B
>>>> and if he tries to save ,it should throw an error like a normal
>>>> blank=False gives. So how can i do this kind of validation in admin .
>>>>
>>>> E.g  Use Case
>>>>
>>>> I have a table having the following structure :-
>>>>
>>>> INTERVIEW_TYPES = (
>>>>
>>>> ('default', 'None'),
>>>> ('Paired Visit','Paired Visit'),
>>>> ('Time Series', 'Time Series'),
>>>>
>>>> ),
>>>>
>>>> class Interview(models.Model):
>>>> ic_number  = models.CharField(verbose_name ="Visit
>>>> Configuration Number",max_length=20,unique=True,null =True,blank=True)
>>>> ic_description = models.TextField(verbose_name ="Visit
>>>> Configuration Description",null = True,blank=True)
>>>> title  = models.CharField(verbose_name ="Visit
>>>> Configuration Title",max_length=80,unique=True)
>>>> starting_section   = models.ForeignKey(Section)
>>>> interview_type = models.CharField(verbose_name = "Mapped
>>>> Visit",choices=CHOICES.INTERVIEW_TYPES, max_length=80, default="Time
>>>> Series")
>>>> select_rating  =
>>>> models.CharField(choices=CHOICES.QUESTION_RATING, max_length=80,
>>>> default="Select Rating")
>>>> view_notes =
>>>> models.CharField(choices=CHOICES.VIEW_NOTES, max_length=80,
>>>> default="Display Notes")
>>>>  revisit= models.BooleanField(default=False)
>>>> .and so on ..
>>>>
>>>> class Meta:
>>>> verbose_name = 'Visit Configuration'
>>>> verbose_name_plural = 'Visit Configurations'
>>>># ordering = ('rpn_number',)
>>>>
>>>>  

Re: django-admin change form page validation

2012-03-30 Thread Nikhil Verma
Hi

I understand that but the problem is its a condition which i have to add if
the revisit checkbox is selected and then in interview_type dropdown None
option is selected ; after pressing save it should throw an error .

None is an option in the dropdown . It is not blank=True and null =True

INTERVIEW_TYPES = (

('default', 'None'),
('Paired Visit','Paired Visit'),
('Time Series', 'Time Series'),

),

interview_type will show choices with dropdown 1) None 2) Paired Visit 3)
Time Series

On Sat, Mar 31, 2012 at 10:28 AM, dummyman dummyman <tempo...@gmail.com>wrote:

> Hi
>
> unless u dont specify blank=True or null = True in modes for d
> corresponding fields, django will throw an errror if u don fill up the field
>
> On Sat, Mar 31, 2012 at 9:25 AM, Nikhil Verma <varma.nikhi...@gmail.com>wrote:
>
>> Hi All
>>
>> How can i apply validation in admin on various fields when they are
>> dependent on each other ?
>>
>> e.g. Let say in i have a  Field A(BooleanField)  and Field B (CharField)
>> what i want to do is if in admin user select the Field A(checkbox) and does
>> not enter anything in Field B
>> and if he tries to save ,it should throw an error like a normal
>> blank=False gives. So how can i do this kind of validation in admin .
>>
>> E.g  Use Case
>>
>> I have a table having the following structure :-
>>
>> INTERVIEW_TYPES = (
>>
>> ('default', 'None'),
>> ('Paired Visit','Paired Visit'),
>> ('Time Series', 'Time Series'),
>>
>> ),
>>
>> class Interview(models.Model):
>> ic_number  = models.CharField(verbose_name ="Visit
>> Configuration Number",max_length=20,unique=True,null =True,blank=True)
>> ic_description = models.TextField(verbose_name ="Visit
>> Configuration Description",null = True,blank=True)
>> title  = models.CharField(verbose_name ="Visit
>> Configuration Title",max_length=80,unique=True)
>> starting_section   = models.ForeignKey(Section)
>> interview_type = models.CharField(verbose_name = "Mapped
>> Visit",choices=CHOICES.INTERVIEW_TYPES, max_length=80, default="Time
>> Series")
>> select_rating  =
>> models.CharField(choices=CHOICES.QUESTION_RATING, max_length=80,
>> default="Select Rating")
>> view_notes = models.CharField(choices=CHOICES.VIEW_NOTES,
>> max_length=80, default="Display Notes")
>>  revisit= models.BooleanField(default=False)
>> .and so on ..
>>
>> class Meta:
>> verbose_name = 'Visit Configuration'
>> verbose_name_plural = 'Visit Configurations'
>># ordering = ('rpn_number',)
>>
>> def __unicode__(self):
>> return self.title
>>
>> Its admin.py
>>
>> class InterviewAdmin(admin.ModelAdmin):
>> list_display = ('id','title',
>> 'starting_section','ic_number','show_prior_responses')
>> raw_id_fields = ('starting_section',)
>> admin.site.register(Interview, InterviewAdmin)
>>
>> In admin , If i select the checkbox of revisit and in the field
>> interview_type(which will show a dropdown having choices None,Paired Visit
>> , Time Series) if a User has selected None from that dropdown and then
>> press save button it should throw me an error like a normal blank=False
>> shows, saying "This field is required"
>>
>> How can i do this kind validation where fields are dependent on each
>> other ?
>>
>> Please Ignore syntax error is any .
>>
>> Thanks
>>
>>
>> --
>> Regards
>> Nikhil Verma
>> +91-958-273-3156
>>
>>  --
>> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: comparing custom template tag within if tag

2012-03-29 Thread Nikhil Verma
Hi All

I am still not able to solve this problem .Any more suggestions ?

Thanks


On Thu, Mar 29, 2012 at 10:03 PM, Tom Evans <tevans...@googlemail.com>wrote:

> On Thu, Mar 29, 2012 at 5:22 PM, Josh Cartmell <joshcar...@gmail.com>
> wrote:
> > I think something like this would work:
> > {% with price_for_pax service pax '' as pfp %}
>
> It won't. The {% with %} tag cannot arbitrarily call custom tags.
>
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

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



comparing custom template tag within if tag

2012-03-28 Thread Nikhil Verma
Hi all

i have a custom template tag that takes some argument and calculates the
result.
I want to compare that value obtained from that custom tag with another
variable.

Custom template tag
{% price_for_pax service pax '' %}

variable :

{{service.price}}

What i want is {% if service.price == price_for_pax service pax ' ' %}
   do something
 {% endif %}

When i look for the result it does not show anything
Can i compare like this ? If not what can be the solution ?

Thanks in advance



-- 
Regards
Nikhil Verma
+91-958-273-3156

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



playing with random number

2012-03-25 Thread Nikhil Verma
Hi all

I have a list say

li = [13,2,13,4]

Now i want to use random number such that the list modifies into a
dictionary like this:-

di = {13: 'abc',2:'def',13:'abc',4:'xyz'}

Point to be noted is if the list contains the number it should generate the
same random number.
How can i achieve this ?

Thanks in advance.

-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: sql for Many To Many Field in existing django model

2012-03-24 Thread Nikhil Verma
Hi

I am able to create the field through in postgres.
When i execute that sql statement :-

CREATE TABLE "visit_visit_research" (
"id" serial NOT NULL PRIMARY KEY,
"visit_id" integer NOT NULL REFERENCES "visit_visit" ("id") DEFERRABLE
INITIALLY DEFERRED,
"research_id" integer NOT NULL REFERENCES "www_researchprotocol" ("id")
DEFERRABLE INITIALLY DEFERRED,
UNIQUE ("visit_id", "research_id")
)
;

I get this :-

psql:db/2012-03-24_research_protocol.sql:7: NOTICE:  CREATE TABLE will
create implicit sequence "visit_visit_research_id_seq" for serial column "
visit_visit_research.id"
psql:db/2012-03-24_research_protocol.sql:7: NOTICE:  CREATE TABLE / PRIMARY
KEY will create implicit index "visit_visit_research_pkey" for table
"visit_visit_research"
psql:db/2012-03-24_research_protocol.sql:7: NOTICE:  CREATE TABLE / UNIQUE
will create implicit index "visit_visit_research_visit_id_key" for table
"visit_visit_research"
CREATE TABLE

So the field gets created but when i am going in django-admin in table
visit i am getting an error.It is not showing up two boxes i mean the many
to many widget which django displays.

This is the error

Exception Type: DatabaseError at /admin/visit/visit/20/
Exception Value: column visit_visit_research.researchprotocol_id does not
exist
LINE 1: ...visit_research" ON ("www_researchprotocol"."id" = "visit_vis...
         ^

Any help will be appreciated.

Thanks in advance.


On Thu, Mar 22, 2012 at 6:26 PM, Joel Goldstick <joel.goldst...@gmail.com>wrote:

> On Thu, Mar 22, 2012 at 6:55 AM, Nikhil Verma <varma.nikhi...@gmail.com>
> wrote:
> > Hi All
> >
> > I want to add a ManyToManyField  to an existing django model.
> >
> > I can use sql app_name and see the statement.
> >
> > My models
> >
> > Class Visit(modes.Model):
> >   x = something
> >   . ..
> >   .. and so on
> >  # finally Here i want to add that field research protol
> >  research_protocol  =
> > models.ManyToManyField(ResearchProtocol,blank=True)
> >
> >
> >
> > class ResearchProtocol(models.Model):
> > title = models.CharField(max_length=30)
> > description = models.TextField()
> > start_date = models.DateField(_("Date Started"))
> > end_date = models.DateField(_("Date Completed"))
> >
> > def __unicode__(self):
> > return '%s' % self.title
> >
> >
> >
> > So i made an sql statement like this:-
> >
> > CREATE TABLE "visit_visit_research_protocols"
> > (
> > "id" integer NOT NULL PRIMARY KEY,
> >
> > "visit_id" integer NOT NULL REFERENCES "visit_visit" ("id")
> DEFERRABLE
> > INITIALLY DEFERRED,
> > "research_protocols_id" varchar(80) NOT NULL REFERENCES
> > "www_researchprotocol" ("title") DEFERRABLE INITIALLY DEFERRED,
> > UNIQUE ("visit_id","research_protocols_id")
> > );
> >
> > The dbshell says:-
> > psql:db/2012-03-22_research_id.sql:8: NOTICE:  CREATE TABLE / PRIMARY KEY
> > will create implicit index "visit_visit_research_protocols_pkey" for
> table
> > "visit_visit_research_protocols"
> > psql:db/2012-03-22_research_id.sql:8: NOTICE:  CREATE TABLE / UNIQUE will
> > create implicit index
> > "visit_visit_research_protocol_visit_id_research_protocols_i_key" for
> table
> > "visit_visit_research_protocols"
> > psql:db/2012-03-22_research_id.sql:8: ERROR:  there is no unique
> constraint
> > matching given keys for referenced table "www_researchprotocol"
> >
> >
> >
> > What mistake i am doing  ?
> >
> > Thanks in advance.
> >
> >
> > --
> > Regards
> > Nikhil Verma
> > +91-958-273-3156
> >
> > --
> > 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 can't add the many to many relationship after you already have the
> model with django.  See this:
>
> http://stackoverflow.com/questions/830130/adding-a-field-to-an-existing-django-model
> 

Re: Autofill dropdown with django

2012-03-22 Thread Nikhil Verma
Hi Abhinav

If i understand you correctly take a look at django-ajax-select.
Home-page: http://code.google.com/p/django-ajax-selects/

This is an autocomplete box which works in the following way :-

Hope it helps you !!!

Let say we have a username textbox(which is ajax-selct field) so i type Ab
... It will give you the list of username that starts with ab.
It has some settings though.

On Thu, Mar 22, 2012 at 11:33 PM, Karthik Abinav
<karthikabin...@gmail.com>wrote:

> hey,
>
>  I needed a autocomplete utility in one of my applications and I was
> wondering if django provides any such option for that. Basically my need is
> a box where user starts typing some name and as he types I need a list of
> suggested autocompletion, to be provided. Something like how when a user
> tries to tag a friend in facebook and it provides options. Help would be
> appreciated.
>
> Thanks,
> Karthik Abinav
>
> --
> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

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



sql for Many To Many Field in existing django model

2012-03-22 Thread Nikhil Verma
Hi All

I want to add a ManyToManyField  to an existing django model.

I can use sql app_name and see the statement.

My models

Class Visit(modes.Model):
  x = something
  . ..
  .. and so on
 # finally Here i want to add that field research protol
 research_protocol  =
models.ManyToManyField(ResearchProtocol,blank=True)



class ResearchProtocol(models.Model):
title = models.CharField(max_length=30)
description = models.TextField()
start_date = models.DateField(_("Date Started"))
end_date = models.DateField(_("Date Completed"))

def __unicode__(self):
return '%s' % self.title



So i made an sql statement like this:-

CREATE TABLE "visit_visit_research_protocols"
(
"id" integer NOT NULL PRIMARY KEY,

"visit_id" integer NOT NULL REFERENCES "visit_visit" ("id") DEFERRABLE
INITIALLY DEFERRED,
"research_protocols_id" varchar(80) NOT NULL REFERENCES
"www_researchprotocol" ("title") DEFERRABLE INITIALLY DEFERRED,
UNIQUE ("visit_id","research_protocols_id")
);

The dbshell says:-
psql:db/2012-03-22_research_id.sql:8: NOTICE:  CREATE TABLE / PRIMARY KEY
will create implicit index "visit_visit_research_protocols_pkey" for table
"visit_visit_research_protocols"
psql:db/2012-03-22_research_id.sql:8: NOTICE:  CREATE TABLE / UNIQUE will
create implicit index
"visit_visit_research_protocol_visit_id_research_protocols_i_key" for table
"visit_visit_research_protocols"
psql:db/2012-03-22_research_id.sql:8: ERROR:  there is no unique constraint
matching given keys for referenced table "www_researchprotocol"



What mistake i am doing  ?

Thanks in advance.


-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Basic Random Number Generation

2012-03-21 Thread Nikhil Verma
Hi Jani

The def random_generator(n): here n parameter is any number which i will
get from my request in a function.
Now when i will get the number let say 101 i will pass this 101 in my
random_generator(n) so it becomes random_generator(101) .

Now in return it should give me 6-digit number. If the 101 comes again in
that function it will generate the same random number.

I read about random.seed but how can i relate that in my case.

Thanks  for help.



On Wed, Mar 21, 2012 at 1:01 PM, Jani Tiainen <rede...@gmail.com> wrote:

> 21.3.2012 9:19, Nikhil Verma kirjoitti:
>
>  Hi All
>>
>> I want to generate a fix 6-digit random number from a function.
>>
>> eg :-
>>
>>  def random_generator(n):
>>   # do domething great
>>   return '6-digit random number'
>>
>> output examples
>>  >>>random_number(6) # n is the input number that i will get from my
>> request
>>  >>>987657
>>
>>  >>>random_number(100)
>>  >>>987647
>>
>>  >>>random_number(6) # if the same input comes again it would generate a
>> same random number
>>  >>>987657
>>
>> If the same input cannot be generated any other way to do this part
>>
>> Any help would be appreciated.
>>
>>
> It seems that you're initializing pseudorandom generator with same seed
> number. So yes, sequence of generated numbers will be same.
>
> so doing something like this:
>
> from random import choice # Initializes from current time.
>
> def random_digits():
>return [choice('0123456789') for i in range(7)]
>
> or if you need it:
>
> from random import randint # Initializes from current time.
>
> def random_int():
>return randit(10, 99)
>
>
> Note that pseudorandom generator is only initialized first time import
> happens. After that you can set it manually using
> random.seed([x]) function.
>
> --
>
> Jani Tiainen
>
> --
> 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+unsubscribe@**
> googlegroups.com <django-users%2bunsubscr...@googlegroups.com>.
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en>
> .
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Basic Random Number Generation

2012-03-21 Thread Nikhil Verma
Hi All

I want to generate a fix 6-digit random number from a function.

eg :-

 def random_generator(n):
  # do domething great
  return '6-digit random number'

output examples
>>>random_number(6) # n is the input number that i will get from my request
>>>987657

>>>random_number(100)
>>>987647

>>>random_number(6) # if the same input comes again it would generate a
same random number
>>>987657

If the same input cannot be generated any other way to do this part

Any help would be appreciated.


-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Why '&' is breaking Django CharField(python strings) into parts?

2012-03-12 Thread Nikhil Verma
Thanks

On Tue, Mar 13, 2012 at 3:38 AM, ajohnston <ajohnston...@gmail.com> wrote:

>
> Is this a good approach ?
>>
>>
>
> Yes, that is a better approach. I was going to suggest that earlier, but
> only now had time to post.
>
> --
> 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/-/t_bxzjIdep4J.
>
> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Why '&' is breaking Django CharField(python strings) into parts?

2012-03-12 Thread Nikhil Verma
Thnaks yati i solved the problem by comparing it with id instead of title
which is the primary key of that Interview Table.

def get_interview_type(request):
i = None
id = request.GET['id']
try:
i = Interview.objects.get(id=id)
if i.interview_type == "Time Series":
visit_ids = i.visit_set.all()
reference_visit_list = []
for visit in visit_ids:
reference_visit_list.append(visit.reference_visit)
reference_visit_list.extend(visit_ids)
list(set(reference_visit_list))
len_visits=filter(None,reference_visit_list)
total_visits = len(len_visits)
return render_to_response('export/get_details.html',

{'visits':visit_ids,'count':visit_ids.count(),
   'total_visits':total_visits},
   context_instance=RequestContext(request)
  )
else:
return render_to_response('export/get_interview_type.html',
  {'visits':i.visit_set.all()},
   context_instance=RequestContext(request)
)
except InterviewTitle.DoesNotExist:
pass

Is this a good approach ?

Thanks

On Mon, Mar 12, 2012 at 7:53 PM, yati sagade <yati.sag...@gmail.com> wrote:

> In an HTTP request, the query parameters are separated by the ampersand. A
> form that has the fields, say, name and email, when submitted via GET, the
> query string will look like "name=myname=s...@email.com". Since
> your html is using literal '&', Django(and any other request parser) will
> think of it as the standard delimiter, and will typically split the query
> string on '&'. That is why your code is breaking.
>
> There are multiple solutions. The simplest I can think of is to use
> "" - without the quotes and WITH the semicolon - whenever you need an
> ampersand (&) in your HTML. That should fix this. There are other ways,
> like percentage encoding (
> http://www.blooberry.com/indexdot/html/topics/urlencoding.htm) you can
> use when you need to generate URLs that contain a literal ampersand.
>
> On Mon, Mar 12, 2012 at 1:48 PM, Nikhil Verma <varma.nikhi...@gmail.com>wrote:
>
>> I have a function in views.py
>>
>> def get_interview_type(request):
>> i = None
>> title = request.GET['title'] #Here the title becomes different
>> try:
>> i = Interview.objects.get(title=title) #it looks for that
>> dropdown value
>> #Error according to pdb
>> #-> i = Interview.objects.get(title=title)
>> #(Pdb)
>> #DoesNotExist: DoesNotE...exist.',)
>>
>> if i.interview_type == "Time Series":
>> visit_ids = i.visit_set.all()
>> reference_visit_list = []
>> for visit in visit_ids:
>> reference_visit_list.append(visit.reference_visit)
>> reference_visit_list.extend(visit_ids)
>> list(set(reference_visit_list))
>> len_visits=filter(None,reference_visit_list)
>> total_visits = len(len_visits)
>> return render_to_response('export/get_details.html',
>>
>> {'visits':visit_ids,'count':visit_ids.count(),
>>'total_visits':total_visits},
>>
>> context_instance=RequestContext(request)
>>   )
>> else:
>> return
>> render_to_response('export/get_interview_type.html',
>>   {'visits':i.visit_set.all()},
>>
>> context_instance=RequestContext(request)
>> )
>> except Interview.DoesNotExist:
>> pass
>>
>> When the user selects a title from the dropdown this function is called
>> and does it tasks.
>> Now i have entered a string which include '&' ampersand thinking that it
>> can play a role of 'and' in normal english like this :-
>>
>> 'CI-2-UGI & Bowel Symptom Screening & Characterization'(It is one of that
>> dropdown value)
>> Now when user selects this value from dropdown the title does not remain
>> the same, instead the title changes to  CI-2-UGI(in title =
>> request.GET['title']) and  before the function executes i recieve a 500
>> error page.
>> This is what the error prints in runs

Why '&' is breaking Django CharField(python strings) into parts?

2012-03-12 Thread Nikhil Verma
I have a function in views.py

def get_interview_type(request):
i = None
title = request.GET['title'] #Here the title becomes different
try:
i = Interview.objects.get(title=title) #it looks for that
dropdown value
#Error according to pdb
#-> i = Interview.objects.get(title=title)
#(Pdb)
#DoesNotExist: DoesNotE...exist.',)

if i.interview_type == "Time Series":
visit_ids = i.visit_set.all()
reference_visit_list = []
for visit in visit_ids:
reference_visit_list.append(visit.reference_visit)
reference_visit_list.extend(visit_ids)
list(set(reference_visit_list))
len_visits=filter(None,reference_visit_list)
total_visits = len(len_visits)
return render_to_response('export/get_details.html',

{'visits':visit_ids,'count':visit_ids.count(),
   'total_visits':total_visits},

context_instance=RequestContext(request)
  )
else:
return
render_to_response('export/get_interview_type.html',
  {'visits':i.visit_set.all()},

context_instance=RequestContext(request)
)
except Interview.DoesNotExist:
pass

When the user selects a title from the dropdown this function is called and
does it tasks.
Now i have entered a string which include '&' ampersand thinking that it
can play a role of 'and' in normal english like this :-

'CI-2-UGI & Bowel Symptom Screening & Characterization'(It is one of that
dropdown value)
Now when user selects this value from dropdown the title does not remain
the same, instead the title changes to  CI-2-UGI(in title =
request.GET['title']) and  before the function executes i recieve a 500
error page.
This is what the error prints in runserver mode
>
/home/user/cpms/careprep/tags/4.0/careprep/export/views.py(66)get_interview_type()->None
-> pass
(Pdb) c
[11/Mar/2012 22:05:20] "GET
/export/get_interview_type/?title=CI-2-UGI%20%20Bowel%20Symptom%20Screening%20%20Characterization
HTTP/1.1" 500 64490

Also when i remove that '&'ampersand from the title there is no 500 page.

Now & is breaks the quesrystring what i know then how to solve the problem.
I try having a look to url -encode but no luck .

I want whatever the drop value contains (&,@ etc) it should not break ?
How to solve the problem ?

Thanks in advance

-- 
Regards
Nikhil Verma
+91-958-273-3156

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



pysvn logging problem

2012-03-09 Thread Nikhil Verma
Hi all

I am using pysvn to take updates. I have a link on admin to update data
when i click on that it gets updated and reloaded.(if there is xml data
change it will update and reloads it)
Now in my local machine when i click to update and reload it works fine but
after that it is breaking .

It is giving ValueError: I/O operation on closed file

Also i view.py i have

def login(*args):
return True, 'nikhilverma', 'nikhil', True



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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 post_save signal ?

2012-03-04 Thread Nikhil Verma
Hi akaariai

I solved my problem by using snippet 1633 FileField/ImageField. Thanks for
making my concept in signals.


On Sun, Mar 4, 2012 at 7:23 PM, akaariai <akaar...@gmail.com> wrote:

> On Sunday, March 4, 2012 3:12:20 PM UTC+2, Nikhil Verma wrote:
>>
>> Hi akaariai
>>
>> As you said i will remove the file and leave the file in file
>> system(mistake for writing delete).
>> Now what i have done is :-
>>
>> image: Currently: 
>> images/testimonial-bottom_2.**png<http://localhost:8000/media/images/testimonial-bottom_2.png>
>> Change: Delete this file
>>
>> When you click the link Delete this file what it will do is it will
>> remove the path 
>> "images/testimonial-bottom_2.**png<http://localhost:8000/media/images/testimonial-bottom_2.png>".But
>>  the problem begins when you press save button and open the same row
>> in django - admin it appears again as if it was not removed and actually it
>> is not removed from that ImageField . i have checked by going through shell.
>>
>> Actually i want implement ImageField of Django1.4b . It  has a
>> checkbox(remove_image) along with the ImageField asking for clear image and
>> when you click on that the image get  removed. How can i get the same thing
>> working for Django1.2.5 which i am using.
>>
>>
> One way is to check the source code of 1.4b and see what it does.
>
>
>> So i thought to make a checkbox ,click on that it will trigger a
>> post_save signal which first looks if the checkbox of remove_image is
>> checked and when save  button is pressed it wil remove the path of image.
>>
>> How can i implement that ? Thanks for help in advance .
>>
>>
> I have a bit hard time following what is the exact thing you want. So, the
> best advice I can give you is this: don't use the post_save signal. Use
> pre_save signal or better yet, a custom ModelForm. You must do the clearing
> of the image field _before_ the data gets saved into the database, and you
> can't do that from post_save signal.
>
>  - Anssi
>
> --
> 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/-/ORkjtr8LBHoJ.
>
> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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 post_save signal ?

2012-03-04 Thread Nikhil Verma
Hi akaariai

As you said i will remove the file and leave the file in file
system(mistake for writing delete).
Now what i have done is :-

image: Currently:
images/testimonial-bottom_2.png<http://localhost:8000/media/images/testimonial-bottom_2.png>
Change: Delete this file

When you click the link Delete this file what it will do is it will remove
the path 
"images/testimonial-bottom_2.png<http://localhost:8000/media/images/testimonial-bottom_2.png>".But
the problem begins when you press save button and open the same row
in django - admin it appears again as if it was not removed and actually it
is not removed from that ImageField . i have checked by going through shell.

Actually i want implement ImageField of Django1.4b . It  has a
checkbox(remove_image) along with the ImageField asking for clear image and
when you click on that the image get  removed. How can i get the same thing
working for Django1.2.5 which i am using.

So i thought to make a checkbox ,click on that it will trigger a post_save
signal which first looks if the checkbox of remove_image is checked and
when save  button is pressed it wil remove the path of image.

How can i implement that ? Thanks for help in advance .



On Sun, Mar 4, 2012 at 6:22 PM, akaariai <akaar...@gmail.com> wrote:

>
> On Sunday, March 4, 2012 12:31:50 PM UTC+2, Nikhil Verma wrote:
>>
>> Hi all
>>
>> I am using Django-1.2.5 and i want to use post_save signal in the
>> following problem/task.
>>
>> I have :-
>> models.py
>>
>> image = models.ImageField(.)
>> remove_image = models.BooleanField()
>>
>> Now i want  :-
>>
>> 1) When the user uploads the file , the file path appears on the
>> imageField like this.
>>
>> Currently: 
>> images/testimonial-bottom_1.**png<http://localhost:8000/media/images/testimonial-bottom_1.png>
>>
>> Change:
>>
>> I want to give the option to delete the file .So i made a field called
>> remove image which is a checkbox . Now when the user clicks that
>> remove_image checkbox and press save the image should get deleted. I was
>> going through the documentation and believe that this problem could be
>> solved by using post_save signal
>>
>>
>> I have not used signals so need help ,
>>
>>
>> def delete_old_image(sender, instance, using=None,*args, **kwargs):
>> try:
>> old_record = sender.objects.get(pk=instance**.pk<http://instance.pk>
>> )
>> old_record.delete()
>> except sender.DoesNotExist:
>> pass
>> signals.post_save.connect(**delete_old_image, sender=Trip)
>>
>> How can i achieve this task by using signals or without signals.
>>
>> Any help will be appreciated.
>>
>> You have a misunderstanding in your code: when you fetch the old_record
> from sender.objects you are actually refetching the instance being saved.
> Then you do on to delete the instance. Is this really what you want?
>
> Now, if you want to delete the file in a signal, you should use pre_save
> signal, where you delete the image using instance.image.delete(save=False)
> or better jet set instance.image = None (see later for details). You should
> probably also clear the "save" flag, as otherwise that gets saved into the
> DB.
>
> Still, it is much better to handle the clearing of the image field by
> using a custom form, and then do the clearing of the image in some hook of
> the form or in the view directly (for ModelForm that would be overridden
> .save()). The checkbox remove_image isn't really part of your data model,
> so it should not be a field in you model class, just a user input element.
>
> Last, for some technicalities about file handling in transactional
> setting: To do file handling properly when using transactional databases
> you should actually do the file delete post-commit. The reason is this
> sequence of events:
>   - delete file
>   - do save
>   - for some reason the transaction is rolled back. (network error,
> integrity error in DB, electricity lost and so on).
>
> Now you have a model in the DB whose file field points to the now deleted
> file. The delete can't be rolled back.
>
> So, to be technically correct, you should do the .delete() in post-commit
> hook. Now the worst case is that the transaction gets committed, but for
> some reason the file can't be deleted (crash of the server at the wrong
> moment). But, this results just in a leftover file in the storage. That is
> easy to clean up and in most cases doesn't matter at all.
>
> As said, this is just a technicality. Django doesn't even provide that
> post-commit hook. I think I am going to suggest a pre/post commit s

How to use post_save signal ?

2012-03-04 Thread Nikhil Verma
Hi all

I am using Django-1.2.5 and i want to use post_save signal in the following
problem/task.

I have :-
models.py

image = models.ImageField(.)
remove_image = models.BooleanField()

Now i want  :-

1) When the user uploads the file , the file path appears on the imageField
like this.

Currently: 
images/testimonial-bottom_1.png<http://localhost:8000/media/images/testimonial-bottom_1.png>

Change:

I want to give the option to delete the file .So i made a field called
remove image which is a checkbox . Now when the user clicks that
remove_image checkbox and press save the image should get deleted. I was
going through the documentation and believe that this problem could be
solved by using post_save signal


I have not used signals so need help ,


def delete_old_image(sender, instance, using=None,*args, **kwargs):
try:
old_record = sender.objects.get(pk=instance.pk)
old_record.delete()
except sender.DoesNotExist:
pass
signals.post_save.connect(delete_old_image, sender=Trip)

How can i achieve this task by using signals or without signals.

Any help will be appreciated.


-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Could someone please give some suggestions about how to set up email sending settings on production.

2012-01-19 Thread Nikhil Verma
Well if i understand you correctly for production you need one email server
may be google apps or Microsoft any one  can help you.
Also if you wana check at your local there is POSTFIX just google around
you will get many articles about configuring it.
In this case you don't need to write your email address and password.

So in your settings.py or settings_local you need something like this.


# Email server config
EMAIL_HOST = 'localhost'
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_PORT = 25
EMAIL_SUBJECT_PREFIX = '[Django] '
SERVER_EMAIL = 'django@localhost'

May be my answer can help you.

On Thu, Jan 19, 2012 at 8:15 AM, Chen Xu <xuche...@gmail.com> wrote:

> Hi, everyone:
>
> Could someone please give some suggestions about how to set up email
> sending settings on production.
>
> I know on local, you can do  either:
> python -m smtpd -n -c DebuggingServer localhost:1025
>
> EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
>
> EMAIL_HOST = 'localhost'
> EMAIL_PORT = 1025
>
> and then email will be printed on the terminal
>
> or
> EMAIL_USE_TLS = True
> EMAIL_HOST = 'smtp.gmail.com'
> EMAIL_PORT = 587
> EMAIL_HOST_USER = 'm...@gmail.com'
> EMAIL_HOST_PASSWORD = 'pw'
>
> but I dont want to use gmail account to send emails on production.
>
> Therefore, could someone please help?
>
>
> Thanks very much
> Best regards
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Replicate admin format in django template

2012-01-12 Thread Nikhil Verma
Hi

I have a column which is a TextField. When we look at django admin it
appears as a box.

models.py
add_detail = models.TextField()

Let say you write the following text in that  add_detail textbox in django
admin :-

 Mission Impossible 4
 Actor : Tom cruise

I am displaying this add_detail in template in the following way:-


{{add_detial}}


I have to display it in a box with proper alignment so i am using it in a
table format.

Now when you look at the template It will appear like this:-

 Mission Impossible 4 Actor : Tom cruise

What i want is the way it is saved in admin add_detail field in whatever
manner whether he gave whitespaces,breaks,press return
it should appear exactly the same in html. How can i achieve this ?


Regards
Nikhil Verma

-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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 to encrypt DateTimeField in models.py ?

2012-01-09 Thread Nikhil Verma
Hi

I am having a requirement that i have to encrypt some of the fields in a
table.
I am using Django 1.3.1 and postgres 9.1. I am referring to this app
django-fields :-

https://github.com/svetlyak40wt/django-fields/blob/master/src/django_fields/fields.py

Here is my code :-

patient_type = EncryptedCharField(max_length=80,
choices=CHOICES.PATIENT_TYPES)
date_of_birth = EncryptedDateField(null=True, blank=True)
gender = EncryptedCharField(max_length=1024, choices=CHOICES.GENDERS,
blank=True)
contact_phone = EncryptedCharField(max_length=1024, blank=True)
security_question = models.ForeignKey(SecurityQuestion, null=True,
blank=True)
security_answer = EncryptedCharField(max_length=1024, null=True,
blank=True)

It stores everything in encrypted form in the database except
date_of_birth.It throws this error

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py"
in get_response
  111. response = callback(request, *callback_args,
**callback_kwargs)
File
"/home/user/slave/old_careprep/CPMS-Source/careprep/../careprep/utilities/decorators.py"
in _dec
  14. return view_func(request, *args, **kwargs)
File
"/home/user/slave/old_careprep/CPMS-Source/careprep/../careprep/visit/views.py"
in setup
  202. patient.save()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in
save
  460. self.save_base(using=using, force_insert=force_insert,
force_update=force_update)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in
save_base
  553. result = manager._insert(values,
return_id=update_pk, using=using)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py"
in _insert
  195. return insert_query(self.model, values, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in
insert_query
  1436. return query.get_compiler(using=using).execute_sql(return_id)
File
"/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py"
in execute_sql
  791. cursor = super(SQLInsertCompiler, self).execute_sql(None)
File
"/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py"
in execute_sql
  735. cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py" in
execute
  34. return self.cursor.execute(sql, params)
File
"/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py"
in execute
  44. return self.cursor.execute(query, args)

Exception Type: DatabaseError at /visit/setup/
Exception Value: invalid input syntax for type date:
"$AES$55403376ed906e119b0f7779554fbb51"
LINE 1: ...L, NULL, '$AES$0452edae035cc33c4084e7b0fb39edd7', '$AES$5540...
 ^
Any help will be appreciated.



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Happy new year

2011-12-31 Thread Nikhil Verma
Happy new year to all of you.

On Sun, Jan 1, 2012 at 10:22 AM, yati sagade <yati.sag...@gmail.com> wrote:

> Happy new year all :)
>
>
> On Sun, Jan 1, 2012 at 7:54 AM, Adrien Lemaire <
> adrien.lema...@aquasys.co.jp> wrote:
>
>> Happy new year dear folks !
>>
>> On Jan 1, 1:48 am, Sławomir Zborowski <stilew...@gmail.com> wrote:
>> > Happy new year, Django users :-) !
>>
>> --
>> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Django app for IP address lookup

2011-12-31 Thread Nikhil Verma
Nice app .Can you share the source code.It will be good.

Happy new Year

On Sat, Dec 31, 2011 at 5:20 PM, Addy Yeow <ayeo...@gmail.com> wrote:

> Hi guys,
>
> Just sharing a simple Django app that allows you to do IP address lookup:
> http://dazzlepod.com/ip/
>
> Happy new year!
>
> --
> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: {% elif %} error

2011-12-27 Thread Nikhil Verma
Go to this link

https://docs.djangoproject.com/en/dev/ref/templates/builtins/

{% if athlete_list %}
Number of athletes: {{ athlete_list|length }}
*{% elif athlete_in_locker_room_list %}*
Athletes should be out of the locker room soon!
{% else %}
No athletes.
{% endif %}

press CLTR + F and type elif you will reach there




On Wed, Dec 28, 2011 at 12:38 PM, Tsung-Hsien <jasoniem9...@gmail.com>wrote:

> Thank you all!
>
> I don't see the line
> "New in Django Development version."
>
> On Dec 27, 10:44 pm, Tsung-Hsien <jasoniem9...@gmail.com> wrote:
> > Hi,
> > I want to use {% elif %}
> > my template:
> > {% if bookmark.hours %}
> > {{ bookmark.hours }} hours ago
> > {% elif bookmark.days %}
> > {{ bookmark.days }} days ago
> > {% elif bookmark.months %}
> > {{ bookmark.months }} months ago
> > {% else %}
> >  {{ bookmark.years }} years ago
> > {% endif %}
> >
> > show error:
> > Invalid block tag: 'elif', expected 'else' or 'endif'
> >
> > It can work without elif, if use if...else loop.
> >
> > my django version is 1.31
> >
> > how to solve this?
> > 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: {% elif %} error

2011-12-27 Thread Nikhil Verma
Hi

It is available in dev/trunl version not this version.

This is  dev version  docs
https://docs.djangoproject.com/en/dev/ref/templates/builtins/

On Wed, Dec 28, 2011 at 12:20 PM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> On Wed, Dec 28, 2011 at 2:44 PM, Tsung-Hsien <jasoniem9...@gmail.com>
> wrote:
> > Hi,
> > I want to use {% elif %}
> > my template:
> >{% if bookmark.hours %}
> >{{ bookmark.hours }} hours ago
> >{% elif bookmark.days %}
> >{{ bookmark.days }} days ago
> >{% elif bookmark.months %}
> >{{ bookmark.months }} months ago
> >{% else %}
> > {{ bookmark.years }} years ago
> >{% endif %}
> >
> >
> > show error:
> > Invalid block tag: 'elif', expected 'else' or 'endif'
> >
> > It can work without elif, if use if...else loop.
> >
> > my django version is 1.31
> >
> > how to solve this?
>
> The {% elif %} tag was only recently added to Django; it will be
> available in the 1.4 release. Django 1.3 and earlier does not, and
> will not ever contain the {% elif %} tag.
>
> You can either develop your site against Django's trunk in the hope
> that Django will release 1.4 before you need to roll out your site, or
> modify your template to use nested {% if %} statements.
>
> Yours,
> Russ Magee %-)
>
> --
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

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



admin media files are not showing up in deployment

2011-12-02 Thread Nikhil Verma
Hi

I am deploying my project.my configuration is like this :-



WSGIScriptAlias /
/home/nikhil/workspace/CPMS-Source/careprep/apache/django.wsgi

ServerName localhost

Alias /media/ /home/nikhil/workspace/CPMS-Source/careprep/media/

Alias /static/ /home/nikhil/workspace/CPMS-Source/careprep/media/


Order allow,deny
Allow from all




My settings.py file :-

STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/;
STATIC_URL = '/static/'

# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/;, "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'

# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
#('/home/user/workspace/CPMS-Source/careprep/media/')
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

My media is present in
/home/nikhil/workspace/CPMS-Source/careprep/media/

The problem is my admin files is are not coming up.Every media files in
project is coming except the admin media.all its css ,js,img are not coming.

Thanks in advance
-- 


Regards
Nikhil Verma
+91-958-273-3156

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



rename a model field

2011-12-02 Thread Nikhil Verma
I have models.py

title  = models.CharField(max_length=80)

to this

ic_name= models.CharField(max_length=80)

I don't want to delete the field.


I have this option
class Migration:


def forwards(self, orm):

# Rename 'name' field to 'full_name'
db.rename_column('app_foo', 'name', 'full_name')

Its giving me an error

Caught TypeError while rendering: coercing to Unicode: need string or
buffer, tuple found

I will appreciate if anyone can tell me a easy way.Thanks in advance




-- 
Regards
Nikhil Verma
+91-958-273-3156

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



add project directory path to python path permanently

2011-12-01 Thread Nikhil Verma
Hi all,

I want to add my django project directory path to PYTHONPATH. I am a newbie
in ubuntu 11.10
Please tell me step by step. When i do
>>>import sys
>>>sys.path.append(''project_directory path")
It does append but not permanently. I want it like whenever i do sys.path
it should show me Project Directory path in PYTHONPATH
-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: cannot connect to postgresql database

2011-11-24 Thread Nikhil Verma
No Problem dear It happens.!!


On Thu, Nov 24, 2011 at 4:38 PM, TANYA <tani...@gmail.com> wrote:

> I keep seeing this message, KSycocaPrivate::openDatabase: Trying to
> open ksycoca from "/var/tmp/kdecache-tani/ksycoca4"
>
>
> On Thu, Nov 24, 2011 at 9:49 AM, Daniel Roseman <dan...@roseman.org.uk>
> wrote:
> > On Thursday, 24 November 2011 09:39:58 UTC, Tanya wrote:
> >>
> >> Page not found (404)
> >> Request Method: GET
> >> Request URL: http://127.0.0.1:8000/
> >>
> >> Using the URLconf defined in mysite.urls, Django tried these URL
> >> patterns, in this order:
> >>
> >>1. ^hello/$
> >>
> >> The current URL, , didn't match any of these.
> >>
> >> You're seeing this error because you have DEBUG = True in your Django
> >> settings file. Change that to False, and Django will display a
> >> standard 404 page.
> >>
> >> is the error when i try the samples from djangobook.com
> >>
> >> TANYA
> >
> > What in that message could possibly lead you to the conclusion that you
> > can't connect to Postgres?
> > --
> > DR.
> >
> > --
> > 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/-/4E6gZUEbVfkJ.
> > 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.
> >
>
>
>
> --
> CHEERS, TANYA
>
> --
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: cannot connect to postgresql database

2011-11-24 Thread Nikhil Verma
Hi Tanya

Okay 404 is a page not found error.

According to your problem what i can say is when there is something wrong
in the urls.py file.
Check it carefully.
Explanation :-
When you type in the url (which should be present in the urls.py file) it
match to a praticular function in views.
I can't see here .Also please specify a little bit code and tell what
exactly you type in urls(address bar)

On Thu, Nov 24, 2011 at 3:09 PM, TANYA <tani...@gmail.com> wrote:

> Page not found (404)
> Request Method: GET
> Request URL:http://127.0.0.1:8000/
>
> Using the URLconf defined in mysite.urls, Django tried these URL
> patterns, in this order:
>
>   1. ^hello/$
>
> The current URL, , didn't match any of these.
>
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Django will display a
> standard 404 page.
>
> is the error when i try the samples from djangobook.com
>
> TANYA
>
> --
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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 uninstall the django version

2011-11-22 Thread Nikhil Verma
Hey ram

If you are in  ubuntu (linux/unix) you need to got to
1) /usr/local/lib/python2.6/dist-packages
2) when you do ls there will be directory called django.
3) do rm -rf django.
By doing this django will be removed.Now you can install any version of
django you want.

If you are windows you need to program files then python2.x then agin in
site-packages delete the django folder and you are good to install the
required version you want.(What i remember ?)

Please specify your environment conditions also.

Hope this may help you !!!
-- 
Regards
Nikhil Verma
+91-958-273-3156

On Tue, Nov 22, 2011 at 5:39 PM, ram <navyanemurugomm...@gmail.com> wrote:

> i want to uninstall my django version (1.3.1) and again i want to
> install the same version.can any one say me how to solve it.
>
> --
> 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.



Re: The name of my User

2011-11-13 Thread Nikhil Verma
Hi

you need to keep the object in memory not in the database i think that what
you are asking .If that

you need to something like this

variablename = Tablename.objects(fieldname = whatever )

do not write after variablename.save() after making this .Don't use create.



On Mon, Nov 14, 2011 at 5:10 AM, chronosx7 <abdak...@gmail.com> wrote:

> Hi, I am new to dJango an now I need to get the name of the user that
> authenticated before the execution of the Save method but I can't seem
> to find any way to accomplish this.
>
> Does anyone know how to do this?
>
> Thanks for your help
>
> --
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: django-shortcuts

2011-11-10 Thread Nikhil Verma
Hi,

You just need to

1) Download the zip or tar file of that module.(type in google django
shortcut various links)
2) There must be a setup.py file.
3) Go to terminal or cmd (windows) .
4) Go to that directory.
5) Type python setup.py install /sudo python setup.py install

On Thu, Nov 10, 2011 at 2:26 PM, Ganesh Kumar <bugcy...@gmail.com> wrote:

> Ho to install django-shortcuts module
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
> [GCC 4.4.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import django.shortcut
> Traceback (most recent call last):
>  File "", line 1, in 
> ImportError: No module named shortcut
> >>> from django.shortcut import render_to_response
> Traceback (most recent call last):
>  File "", line 1, in 
> ImportError: No module named shortcut
> >>> import django.shortcut
> Traceback (most recent call last):
>  File "", line 1, in 
> ImportError: No module named shortcut
> >>>
>
> please guide me how to install django-shortcut module.
>
>
> Did I learn something today? If not, I wasted it.
>
> --
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: 2 settings files importing one to the other - problem

2011-11-09 Thread Nikhil Verma
make one file settings_local put all your local settings on that file and
in seettings.py file just write from settings_local import * in settings.py
file.Be careful about the path.

On Thu, Nov 10, 2011 at 11:45 AM, RKumar Its mee <rohitkumar...@gmail.com>wrote:

> I hope you much have tired with Git repository. When you want to import,
> click on the project in which you need to import, and you get options.
> Either through git repository connection settings. Have you tried, it.
> Though I am new to Django. But I am trying to work from this IDE, so
> pertaining to IDE I could think about this solution would work
>
> On Fri, Oct 7, 2011 at 7:13 PM, MeME <maciej.macias...@gmail.com> wrote:
>
>> Hello everybody,
>>
>> Have anybody of you worked in AptanaStudio? I have problems with one
>> project where I have 2 settings files.
>> I'm trying to import one to another.
>> Problems appear when I runserver: http://screencast.com/t/BhM5gn1t
>>
>> --
>> Regards
>> MM
>>
>> --
>> 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.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
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: Best UI for Django

2011-11-09 Thread Nikhil Verma
Just install jquery libraries as we do in other frameworks and give the
path of on the page where you want to apply the jquery.Use its functions
tools whatever .You can use ajax in similar way.Everything is same .You
just need to do this in your templates/.html files

I am giving you an example
{% block js %}



{% endblock %}

On Wed, Nov 9, 2011 at 9:02 PM, Ganesh Kumar <bugcy...@gmail.com> wrote:

> Hi guys,
>
> I am beginner of django, I have creating application using django. How
> integrate with jquery with django, please share your thoughts.
> please guide me.
>
> -Ganesh.
> Did I learn something today? If not, I wasted it.
>
> --
> 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.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

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



override ModelChoiceField attribute queryset ( Tablename.objects.none() )

2011-11-09 Thread Nikhil Verma
Hi ,

I am a newbie in django and come across this problem
Description :-
I have a ModelForm which contain a field
class VisitSetupForm(Form):

list_visit_ids = ModelChoiceField(queryset=Visit.objects.none(),
empty_label='Select Revisit ID',required=False)
Now in the server i want not to load all the objects of table Visit
because its too large so for that i wrote the above queryset but when
the user fills in the form where he select the Visit id objects which
i making it avaiable through ajax .Now when i hit the submit button
the form does not save and it goes to invalid condition.
When i do this
list_visit_ids = ModelChoiceField(queryset=Visit.objects.all(),
empty_label='Select Revisit ID',required=False)
everything works fine on my local but on server the database is huge
and the browser page loads forever
Somehow i want to save that field data(Visit object that the user has
selected) .I have google it but not finding the appropriate way to
implement.I have also seen some __init__ way to overide ,
So can anyone sugggest a proper way to override this and somehow the
Visit objects gets saved.

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.