Re: get_ip_address() not working when used Custom Decorators

2017-09-30 Thread Mannu Gupta
Hello Constantine C,

Thanks for your reply!

What do you mean to say just one place ?
I just printed the request using `print(request)` and getting this 
`` ( don't know what this actually is )

Am i using the following approach.
On Saturday, September 30, 2017 at 8:08:22 AM UTC+5:30, Constantine 
Covtushenko wrote:
>
> Hi Mannu,
>
> It seems like all are ok.
> Sorry, but do you use it in just one place?
> And do you see response in console from your print?
>
> Regards,
> Constantine C.
>
> On Thu, Sep 28, 2017 at 4:36 PM, Mannu Gupta <abhiman...@gmail.com 
> > wrote:
>
>> I am just using it in a view function. For example:-
>>
>> @owner_required
>> def all(request, **kwargs):
>> pass
>>
>>
>> On Friday, September 29, 2017 at 12:33:09 AM UTC+5:30, Mannu Gupta wrote:
>>>
>>> While making a customer decorator in django, the code is here :-
>>>
>>> def owner_required(function):
>>> def wrap(request, *args, **kwargs):
>>> print(request)
>>> ip_address = get_client_ip(request)
>>> ip_exist = Node.objects.get(ip_address=ip_address)
>>> if ip_exist:
>>> return function(request, *args, **kwargs)
>>> else:
>>> raise PermissionDenied
>>> return wrap
>>>
>>> my code for get_ip_address() is :-
>>>
>>> def get_client_ip(request):
>>> """ Extract ip address from a Django request object
>>> """
>>> x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
>>> if x_forwarded_for:
>>> ip = x_forwarded_for.split(',')[0]
>>> else:
>>> ip = request.META.get('REMOTE_ADDR')
>>> return ip
>>>
>>> The error i am getting is :-
>>>
>>> x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
>>> AttributeError: 'function' object has no attribute 'META'
>>>
>>>
>>> That get_client_ip() is working fine when used in normal function, but 
>>> don't know why it is not working when i am using it a decorator.
>>>
>>> What might be the problem ?
>>>
>>> Thanks in advance for replies.
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/0e34ae73-5697-4a93-9402-c0ca1f4abd70%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/0e34ae73-5697-4a93-9402-c0ca1f4abd70%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Sincerely yours,
> Constantine C
>

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


Re: get_ip_address() not working when used Custom Decorators

2017-09-28 Thread Mannu Gupta
I am just using it in a view function. For example:-

@owner_required
def all(request, **kwargs):
pass


On Friday, September 29, 2017 at 12:33:09 AM UTC+5:30, Mannu Gupta wrote:
>
> While making a customer decorator in django, the code is here :-
>
> def owner_required(function):
> def wrap(request, *args, **kwargs):
> print(request)
> ip_address = get_client_ip(request)
> ip_exist = Node.objects.get(ip_address=ip_address)
> if ip_exist:
> return function(request, *args, **kwargs)
> else:
> raise PermissionDenied
> return wrap
>
> my code for get_ip_address() is :-
>
> def get_client_ip(request):
> """ Extract ip address from a Django request object
> """
> x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
> if x_forwarded_for:
> ip = x_forwarded_for.split(',')[0]
> else:
> ip = request.META.get('REMOTE_ADDR')
> return ip
>
> The error i am getting is :-
>
> x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
> AttributeError: 'function' object has no attribute 'META'
>
>
> That get_client_ip() is working fine when used in normal function, but 
> don't know why it is not working when i am using it a decorator.
>
> What might be the problem ?
>
> Thanks in advance for replies.
>
>

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


get_ip_address() not working when used Custom Decorators

2017-09-28 Thread Mannu Gupta
While making a customer decorator in django, the code is here :-

def owner_required(function):
def wrap(request, *args, **kwargs):
print(request)
ip_address = get_client_ip(request)
ip_exist = Node.objects.get(ip_address=ip_address)
if ip_exist:
return function(request, *args, **kwargs)
else:
raise PermissionDenied
return wrap

my code for get_ip_address() is :-

def get_client_ip(request):
""" Extract ip address from a Django request object
"""
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
if x_forwarded_for:
ip = x_forwarded_for.split(',')[0]
else:
ip = request.META.get('REMOTE_ADDR')
return ip

The error i am getting is :-

x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
AttributeError: 'function' object has no attribute 'META'


That get_client_ip() is working fine when used in normal function, but 
don't know why it is not working when i am using it a decorator.

What might be the problem ?

Thanks in advance for replies.

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


Encrypt Directory in Django

2017-09-27 Thread Mannu Gupta
I am trying to save a customer generated report in pdf format. I have used 
django file field to store the pdf. 

"models.FileField(upload_to='directory/pdfdirectory')"

Since it will be user-generated pdf and will be different for each user, 

Also along with making a custom subdirectory for every user (one encrypted 
folder per user), there may be multiple files within that.

Link if there are 100 users then all that 100 subdirectories should be 
encrypted.

What might be best possible way to implement the encryption part ?

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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/278347b3-4ec9-411c-b7ae-58f4ac7ed30e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting response code 302 instead of 200 while testing a url

2017-07-31 Thread Mannu Gupta
Hi James,

Thanks for the reply!

As in the setup function for my tests i have already created a Post object
then how just visiting a url i.e '/update/' and 'delete/' of that object
can be a considered 'POST' request.

Also Is there any way to capture the inbetween changing process of status
code i.e from 302 to 200 ? I have tried Postman but it was giving 200 staus
code for visiting the 'update' url of the post that i had already created.

As you mentioned it is hard to debug without reading code, what part of
code more should i send ?


Mannu

On Fri, Jul 28, 2017 at 10:43 AM, James Schneider 
wrote:

>
> The problem here is that my test cased passed for the first 2 functions
> i.e. "test_post_list" and "test_post_create" but now working for other two
> test functions i.e "test_post_update" and "test_post_delete". What might be
> the problem ?
>
> The setup function that i made is supposed to create a object of model
> named "Post", then what might be the problem ?
>
> Actually,  that's probably a valid/correct response. In general, when
> sending a POST request, a redirect (the 302) is returned by a view to
> another landing page (where you would then receive a 200), where the
> successful message is displayed to the user. This is done to prevent the
> user from submitting the form multiple times by clicking the back button
> (the browser presents the "are you sure you want to send this data again?"
> message).
>
> The generic create/update views included with Django have this behavior.
>
> Without seeing the views, it's hard to tell for sure.
>
> -James
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/uZ1oGmHWWB8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CA%2Be%2BciWSCD9hK_cViYgFJuFOXFvC%
> 2Bp1Wxz1oMFuHOySvhZYnAw%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Getting response code 302 instead of 200 while testing a url

2017-07-27 Thread Mannu Gupta
I have a django named blog and trying to test the url. The code for testing 
is :-

class PostTests(TestCase):

def setUp(self):
self.user = get_user_model().objects.create(username='some_user')
self.title = "test-title"
Post.objects.create(
title=self.title, user=self.user,
publish=datetime.date.today()
)

def test_post_list(self):
response = self.client.get('/posts/search/')
self.assertEqual(response.status_code, 200)

def test_post_create(self):
response = self.client.get('/posts/create/')
self.assertEqual(response.status_code, 200)

def test_post_update(self):
response = self.client.get('/posts/test-title/update/')
self.assertEqual(response.status_code, 200)

def test_post_delete(self):
response = self.client.get('/posts/test-title/delete/')
self.assertEqual(response.status_code, 200)





The problem here is that my test cased passed for the first 2 functions 
i.e. "test_post_list" and "test_post_create" but now working for other two 
test functions i.e "test_post_update" and "test_post_delete". What might be 
the problem ?

The setup function that i made is supposed to create a object of model 
named "Post", then what might be the problem ?

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


Testing UpdateView in Django using Unittest

2017-07-27 Thread Mannu Gupta
I am writing a test case for my Django application named "blog". I am 
getting the following errors :-

1. I am testing my view function i.e PostUpdateview the code is 

class PostUpdateView(LoginRequiredMixin, UserOwnerMixin, UpdateView):
model = Post
form_class = PostModelForm
template_name = 'posts/update_view.html'

def get_context_data(self, *args, **kwargs):
context = super(PostUpdateView, self).get_context_data(*args, 
**kwargs)
context['title'] = self.object.title
print(context['title'])
return context

def form_valid(self, form):
updated_post = form.save(commit=False)
form.instance.user = self.request.user
updated_post.save()
self.object = updated_post
return super(PostUpdateView, self).form_valid(form)

def get_success_url(self):
post_slug = self.slug
print(post_slug)
return reverse('posts:detail', kwargs={'slug': post_slug}

The test code for the same is :-
class TestPostUpdateView(BaseUserTestCase):

def setUp(self):
# call BaseUserTestCase.setUp()
super(TestPostUpdateView, self).setUp()
# Instantiate the view directly. Never do this outside a test!
self.view = PostUpdateView()
# Generate a fake request
request = self.factory.get('/test-title/update')
# Attach the user to the request
request.user = self.user
# Attach the request to the view
self.view.request = request

def test_get_success_url(self):
# Expect: '/users/testuser/', as that is the default username for
#   self.make_user()
self.assertEqual(
self.view.get_success_url(),
'/posts/test-title/'
)

def test_get_object(self):
# Expect: self.user, as that is the request's user object
self.assertEqual(
self.view.get_object(),
self.title
)
The traceback is :-
ERROR: test_get_object (blog.test.test_views.TestPostUpdateView)
--
Traceback (most recent call last):
  File 
"/media/abhi/300Gb/Office/itoucan_2017/itoucan/blog/test/test_views.py", 
line 96, in test_get_object
self.view.get_object(),
  File 
"/media/abhi/300Gb/Office/venv/lib/python3.5/site-packages/django/views/generic/detail.py",
 
line 35, in get_object
pk = self.kwargs.get(self.pk_url_kwarg)
AttributeError: 'PostUpdateView' object has no attribute 'kwargs'

==
ERROR: test_get_success_url (blog.test.test_views.TestPostUpdateView)
--
Traceback (most recent call last):
  File 
"/media/abhi/300Gb/Office/itoucan_2017/itoucan/blog/test/test_views.py", 
line 89, in test_get_success_url
self.view.get_success_url(),
  File "/media/abhi/300Gb/Office/itoucan_2017/itoucan/blog/views.py", line 
45, in get_success_url
post_slug = self.slug
AttributeError: 'PostUpdateView' object has no attribute 'slug'

What might be the problem ?

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


Re: User Based role in Django

2017-06-21 Thread Mannu Gupta
I meant that using your method i.e by making different groups .
When he upgrade the group .
How about making another table having user, his subscription level and
changed_at field(which traces when he /upgrade the group )

Just want to know your suggestion .

Mannu

On Jun 21, 2017 1:48 PM, "Jani Tiainen" <rede...@gmail.com> wrote:

> Well its your code, so yes if you write code that does it.
>
> It doesn't happen magically for you.
>
> 21.6.2017 11.15 "Mannu Gupta" <abhimanyu98...@gmail.com> kirjoitti:
>
>> Hi ,
>> Will I be able to trace if user upgrde the subscription level ?
>>
>> Manni
>>
>> On Wed, Jun 21, 2017 at 1:41 PM, Jani Tiainen <rede...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> We have been using user groups for that. And then we check and filter
>>> out based on given group(s).
>>>
>>> 21.6.2017 10.45 "Mannu Gupta" <abhimanyu98...@gmail.com> kirjoitti:
>>>
>>>> I want to make a role based user in Django like the following :-
>>>>
>>>> User with Subscription level 0 will have some feature and some basic
>>>> fields like first name , last name etc.
>>>> User with Subscription level 1 will have some more feature and some
>>>> extra fields  like tax-id , national id , nationality, is_disable etc .
>>>> User with Subscription level 2 will have more features with all the
>>>> fields with the fields with same as fields of Subscription level 1 since he
>>>> has already subscribed only he is upgrading.
>>>> User with Subscription level 3 will have more feature with all the
>>>> fields with the fields same above .
>>>>
>>>> How do i make the user model and related this relate to its role , and
>>>> how do i be able to set permission for different user ?
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to django-users@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>>> gid/django-users/4bdc5c54-5c90-4515-b977-30fcb612b3ff%40goog
>>>> legroups.com
>>>> <https://groups.google.com/d/msgid/django-users/4bdc5c54-5c90-4515-b977-30fcb612b3ff%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/django-users/2JjuGF1-4PU/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/CAHn91od9D9aeoigGQ4aN3NKX_woJn%2BENPrePMg%2
>>> BKEKhZBb-W9Q%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAHn91od9D9aeoigGQ4aN3NKX_woJn%2BENPrePMg%2BKEKhZBb-W9Q%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/CAEDhgmi-cONKSHSBBJOJu6JKPy42-n4zfDY%2BeUmO
>> QyMXm1bj-A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAEDhgmi-cONKSHSBBJOJu6JKPy42-n4zfDY%2BeUmOQyMXm1bj-A%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received t

Re: User Based role in Django

2017-06-21 Thread Mannu Gupta
Hi ,
Will I be able to trace if user upgrde the subscription level ?

Manni

On Wed, Jun 21, 2017 at 1:41 PM, Jani Tiainen <rede...@gmail.com> wrote:

> Hi,
>
> We have been using user groups for that. And then we check and filter out
> based on given group(s).
>
> 21.6.2017 10.45 "Mannu Gupta" <abhimanyu98...@gmail.com> kirjoitti:
>
>> I want to make a role based user in Django like the following :-
>>
>> User with Subscription level 0 will have some feature and some basic
>> fields like first name , last name etc.
>> User with Subscription level 1 will have some more feature and some extra
>> fields  like tax-id , national id , nationality, is_disable etc .
>> User with Subscription level 2 will have more features with all the
>> fields with the fields with same as fields of Subscription level 1 since he
>> has already subscribed only he is upgrading.
>> User with Subscription level 3 will have more feature with all the fields
>> with the fields same above .
>>
>> How do i make the user model and related this relate to its role , and
>> how do i be able to set permission for different user ?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/4bdc5c54-5c90-4515-b977-30fcb612b3ff%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/4bdc5c54-5c90-4515-b977-30fcb612b3ff%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/2JjuGF1-4PU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAHn91od9D9aeoigGQ4aN3NKX_
> woJn%2BENPrePMg%2BKEKhZBb-W9Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHn91od9D9aeoigGQ4aN3NKX_woJn%2BENPrePMg%2BKEKhZBb-W9Q%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


User Based role in Django

2017-06-21 Thread Mannu Gupta
I want to make a role based user in Django like the following :- 

User with Subscription level 0 will have some feature and some basic fields 
like first name , last name etc. 
User with Subscription level 1 will have some more feature and some extra 
fields  like tax-id , national id , nationality, is_disable etc . 
User with Subscription level 2 will have more features with all the fields 
with the fields with same as fields of Subscription level 1 since he has 
already subscribed only he is upgrading.
User with Subscription level 3 will have more feature with all the fields 
with the fields same above .

How do i make the user model and related this relate to its role , and how 
do i be able to set permission for different user ?

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


Re: Django Internship

2017-05-19 Thread Mannu Gupta


On Wednesday, May 17, 2017 at 3:25:42 PM UTC-4, mark wrote:
>
> A couple of comments..
>
> 1. This list is not for job hunting. Learn how to post correctly on email 
> lists. In this instance, you need an OT (Off Topic) at the start of your 
> subject line as this is a list for asking technical questions about Django. 
> More people will want to help you if you respect the purpose of each email 
> list you post on.
>

I reallly want to aplozgize for my mistake and will never repeat it next 
time.I also want to thanks for your time to write about the mistakes. 

>
> 2. No one will sign in to Google drive to see your resume. It should be 
> readable on your web site in both plain text and pdf (NOT downloads).
>

So is there anything that you suggest rather than google drive to upload 
the resume such that is will directly open in browser ? 

>
> 3. Never tell a prospective employer that you hate something ("...and 
> just hates Front-end ."). Always tell them what you have accomplished, 
> what you are good at and what you enjoy doing. Always be open minded about 
> learning new things/technologies/etc until you have a lot more experience, 
> many more accomplishments, and at least a hint of gray hair. ;)
>

Again thanks for the suggestion and now i have changed the intro part :) 

>
> 4. If you are going to post the code you wrote, then you better be sure it 
> is golden. functions.php has no comments, poor style, and I have no idea 
> what it does. Not the code I want to have in my products. Learn how to 
> write code that others can easily support, then post that code to your web 
> site so others will be impressed. There are all sorts of style guides for 
> php, python, java, etc. Learn them and apply them to the code you publish 
> for others to see (actually all your code).
>
> 5. Not sure what all these courses are listed on your site. Did you take 
> them? If so, then they should be in your resume and not here. If you are 
> just trolling the web for content, don't make me guess what it is and don't 
> make me look at them. You are making yourself look very undesirable as a 
> candidate for an internship by just adding fluff to your github account. 
> Get rid of it. If you are just starting out and don't have a lot of 
> projects, that is OK. Showing me one project where you really excelled  (eg 
> see #4) is far better than a lot of poorly done projects with irrelevant 
> fluff surrounding them.
>

Now I have pinned the good projects that i have done, now it is looking 
better.Previously I did now know the feature of pinned repository on 
github. 

>
> Good luck!
>
> Mark
>
> On Wed, May 17, 2017 at 11:55 AM, Mannu Gupta <abhiman...@gmail.com 
> > wrote:
>
>> Hi everyone,
>>
>> I have been learning on Django for around 6+ months, Now looking for a 
>> internship based on it .If anyone know about any internship offer then 
>> please let me know.
>>
>> My Website :- http://theparadoxer02.github.io 
>> Github:-  http://github.com/theparadoxer02
>>
>> Thanks
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/f9a00b76-81b3-414b-a53a-84ab2c43a8cf%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/f9a00b76-81b3-414b-a53a-84ab2c43a8cf%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


Django Internship

2017-05-17 Thread Mannu Gupta
Hi everyone,

I have been learning on Django for around 6+ months, Now looking for a 
internship based on it .If anyone know about any internship offer then 
please let me know.

My Website :- http://theparadoxer02.github.io 
Github:-  http://github.com/theparadoxer02

Thanks

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


Not upoading image files in django

2016-08-27 Thread Mannu Gupta
Image file is not getting uploaded using Django my all model,view and forms 
files are attached with this link

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b0d0dbbf-d8d6-45e8-96fe-1f720bd2051a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
from django.shortcuts import render
from django.utils import timezone
from .models import Post
from django.shortcuts import render, get_object_or_404,redirect
from .forms import PostForm,profileform
from .models import Profile

# Create your views here.
def post_list(request):
	posts = Post.objects.all()
	return render(request, 'blog/post_list.html',{'posts':posts})


def post_detail(request, pk):
post = get_object_or_404(Post, pk=pk)
return render(request, 'blog/post_detail.html', {'post': post})

def post_new(request):
if request.method == "POST":
form = PostForm(request.POST)
if form.is_valid():
post = form.save(commit=False)
post.author = request.user
post.published_date = timezone.now()
post.save()
return redirect('post_detail', pk=post.pk)
else:
form = PostForm()
return render(request, 'blog/post_edit.html', {'form': form})

def post_edit(request, pk):
post = get_object_or_404(Post, pk=pk)
if request.method == "POST":
form = PostForm(request.POST, instance=post)
if form.is_valid():
post = form.save(commit=False)
post.author = request.user
post.published_date = timezone.now()
post.save()
return redirect('post_detail', pk=post.pk)
else:
form = PostForm(instance=post)
return render(request, 'blog/post_edit.html', {'form': form})


def SaveProfile(request):
   saved = False
   
   if request.method == "POST":
  #Get the posted form
  MyProfileForm = ProfileForm(request.POST, request.FILES)
  
  if MyProfileForm.is_valid():
 profile = Profile()
 profile.name = MyProfileForm.cleaned_data["name"]
 profile.picture = MyProfileForm.cleaned_data["picture"]
 profile.save()
 saved = True
 return redirect('showProfile')
   else:
  MyProfileForm = ProfileForm()

   return render(request, 'saved.html', locals())


def showProfile(request):
profiles = Profile.objects.all()
return render(request,'blog/profiles.html',{'profiles':profiles})


def addNotes(request):
if request.method == "POST":
form = profileform(request.POST,request.FILES)
if form.is_valid():
print('done')
# profile = Profile()
# profile.name = form.cleaned_data["name"]
# profile.picture = form.cleaned_data["picture"]
post = form.save(commit=False)
#post.published_date = timezone.now()
profile.save()
return redirect('showProfile')
else:
form = profileform()
return render(request, 'blog/newNotes.html', {'form': form})from django.db import models
from django.utils import timezone


class Post(models.Model):
author = models.ForeignKey('auth.User')
title = models.CharField(max_length=200)
text = models.TextField()
created_date = models.DateTimeField(
default=timezone.now)
published_date = models.DateTimeField(
blank=True, null=True)

def publish(self):
self.published_date = timezone.now()
self.save()

def __str__(self):
return self.title

class Profile(models.Model):
   name = models.CharField(max_length = 50)
   picture = models.ImageField(upload_to = 'blog/media')

   class Meta:
  db_table = "profile"
from django import forms
from .models import Profile
from .models import Post,Profile

class PostForm(forms.ModelForm):

class Meta:
model = Post
fields = ('title', 'text',)

# class ProfileForm(forms.Form):
#name = forms.CharField(max_length = 100)
#picture = forms.ImageField()

class profileform(forms.ModelForm):

 	class Meta:
 		model = Profile
 		fields = ('name','picture')