Re: jquery deployment

2019-05-30 Thread Mike Dewhirst
All versions of Django from 1.11 to 2.1 are working fine with py3.6 and 
py3.7. Only 2.2 barfs.


I now suspect my Stripe integration which is somewhat behind the wave 
front at rev 2.0.3. It too uses js heavily. That is where I'm looking at 
the moment.


I still hate js and hope someone can offer advice on managing js deployment.

Thanks

Mike

On 30/05/2019 8:22 pm, Mike Dewhirst wrote:
I just encountered a weird UI glitch[1] in the Admin after upgrading 
to Django 2.2.1


I checked and found the version of jquery I'm using is 1.4.1 and 
figured that has to be contributing to the problem.


The 2.1 release note says "jQuery is upgraded from version 2.2.3 to 
3.3.1." so I dug deeper in the docs to find how it is upgraded. Can't 
find anything so far. I saw that there are Django Admin javascript 
customisations. So that might complicate matters.


Is there a best practice for ensuring I keep my projects up to date?

Thanks

Mike

[1] With a m2m (self) adding another instance clicking on the {SHOW} 
link just relocates to the top of the page. Has to be a jQuery thing 
doesn't it?




--
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/bfd0ac3e-77bd-dcc6-452a-a15f8c59e883%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing request from form

2019-05-30 Thread Mike Dewhirst


On Thursday, May 30, 2019 at 7:26:57 PM UTC+10, James Schneider wrote:
>
> I always dread being the guy that responds to his own thread with "Hey 
> guys, I fixed it."
>

Don't beat yourself up :)

No-one stops looking and just waits for the answer. You have to assume your 
own motivation to find it is stronger than everyone else's. It is just good 
manners to report back so others can stop looking. And it would be bad 
manners to say you fixed it without revealing the fix. 

Actually, no-one else even looks unless they are particularly interested or 
they encountered the same problem within recent memory.

Except you. You have helped me more than once in the past and I appreciate 
it. Thank you. Ten extra points!

Cheers

Mike

 

>
> At any rate, I'm currently stuck having to create relatively empty 
>> ModelForm shell classes for the simple reason of including a form mixin 
>> that grabs the request before __init__() (because the ModelForm complains 
>> if I don't), and overrides save() to save the fields with the user object, 
>> in addition to specifying the form_class in the CBV along with a view mixin 
>> for sending the request over via get_form_kwargs(). It's quite a process, 
>> especially when dealing with multiple models. I could drop a significant 
>> amount of code if I could flag the CBV to include the request with the form 
>> initialization. Heck, there could even be some magic to have the form 
>> associate the user with specific fields on save from the view as 
>> form_kwargs.
>>
>> Or am I making things hard on myself? Thanks.
>>
>
> For the use case above, I had an epiphany did some more experimenting and 
> figured out how to update the audit fields without needing to mangle a 
> Form/ModelForm, entirely from the CBV:
>
>  def form_valid(self, form):
> form.instance.updated_by = self.request.user
> return super().form_valid(form)
>
> Fully compatible with an implicit ModelForm, and only 3 lines of code!
>
> This is an easy drop in a view mixin, which I already have for other 
> overrides anyway. However, this feels really gross, and I feel like I'm 
> violating some prime directive by attaching data to an instance that was 
> not validated by the form. I think I can forgive myself since the data I'm 
> attaching is coming from Django and not some other source, and I have to 
> assume Django handles these things properly.
>
> Of course while writing this message, I then stumbled on this exact 
> solution buried in the Django docs:
>
>
> https://docs.djangoproject.com/en/dev/topics/class-based-views/generic-editing/#models-and-request-user
>
> So, feel free to ignore me. I will grant myself a point for coming up with 
> the same solution already blessed by the Django devs. I'm also deducting a 
> point from myself for not RTFM properly, so I break even.
>
> -James
>

-- 
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/45a778f0-9977-4320-a791-912c4d66f826%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use permissions on a CreateView class?

2019-05-30 Thread Andrew C.
Sorry. Info ISN’T saved on private browser

On Thu, May 30, 2019 at 7:25 PM Andrew C.  wrote:

> Try clearing your browser history and info. Should also test in Incognito
> or Private browser so info is saved. I have a suspicion that your browser
> is saving login info and you’re just not realizing this.
>
> On Tue, May 28, 2019 at 5:54 PM Fellipe Henrique 
> wrote:
>
>> Hi Jim,
>>
>> Tried that, as you can see on my code, but not working.. when user type
>> the url, still see the template..
>>
>> Any suggestions?
>>
>> Regards,
>>
>> T.·.F.·.A.·. S+F
>> *Fellipe Henrique P. Soares*
>>
>> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
>> 's/(.)/chr(ord($1)-2*3)/ge'
>> *Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh
>> *
>> *Blog: *http:www.fellipeh.eti.br
>> *GitHub: https://github.com/fellipeh *
>> *Twitter: @fh_bash*
>>
>>
>> On Tue, May 28, 2019 at 2:36 PM Jim Illback 
>> wrote:
>>
>>> I think you can also add to your class (right under your *template_name*…
>>> for example) this statement:
>>>
>>> permission_required = *‘*appname.permission_name'
>>>
>>> This will limit to logged on users (as below), and also to users who 
>>> possess this permission.
>>>
>>> Jim
>>>
>>>
>>> On May 28, 2019, at 9:55 AM, Joe Reitman  wrote:
>>>
>>> Fellipe,
>>>
>>> Here is an example of decorating class based views from the
>>> documentation
>>> 
>>> :
>>>
>>> from django.contrib.auth.decorators import login_requiredfrom 
>>> django.utils.decorators import method_decoratorfrom django.views.generic 
>>> import TemplateView
>>> class ProtectedView(TemplateView):
>>> template_name = 'secret.html'
>>>
>>> @method_decorator(login_required)
>>> def dispatch(self, *args, **kwargs):
>>> return super().dispatch(*args, **kwargs)
>>>
>>>
>>> On Tuesday, May 28, 2019 at 6:54:38 AM UTC-5, Fellipe Henrique wrote:

 Hello,

 I have these class, based on CreateView class... and I only want allow
 user with these permissions to add record...

 class ClienteCreateView(ERPbrViewMixin, CreateView):
 template_name = 'cadastro/cliente/form.html'
 permission_required = ('cliente.can_open', 'cliente.can_edit', 
 'cliente.can_add')
 model = Cliente
 form_class = ClienteForm

 But, not working... user without these permission, when type the url
 show the form...

 Any tips how to do that?

 Cheers!


 T.·.F.·.A.·. S+F
 *Fellipe Henrique P. Soares*

 e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
 's/(.)/chr(ord($1)-2*3)/ge'
 *Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh
 *
 *Blog: *http:www.fellipeh.eti.br 
 *GitHub: https://github.com/fellipeh *
 *Twitter: @fh_bash*

>>>
>>> --
>>> 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/060a2c59-bf39-456c-a686-bf6ba104e1f7%40googlegroups.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/B5E64E45-C1C3-455F-AEC7-167852FE17C7%40hotmail.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

Re: How to use permissions on a CreateView class?

2019-05-30 Thread Andrew C.
Try clearing your browser history and info. Should also test in Incognito
or Private browser so info is saved. I have a suspicion that your browser
is saving login info and you’re just not realizing this.

On Tue, May 28, 2019 at 5:54 PM Fellipe Henrique  wrote:

> Hi Jim,
>
> Tried that, as you can see on my code, but not working.. when user type
> the url, still see the template..
>
> Any suggestions?
>
> Regards,
>
> T.·.F.·.A.·. S+F
> *Fellipe Henrique P. Soares*
>
> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
> 's/(.)/chr(ord($1)-2*3)/ge'
> *Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh
> *
> *Blog: *http:www.fellipeh.eti.br
> *GitHub: https://github.com/fellipeh *
> *Twitter: @fh_bash*
>
>
> On Tue, May 28, 2019 at 2:36 PM Jim Illback  wrote:
>
>> I think you can also add to your class (right under your *template_name*…
>> for example) this statement:
>>
>>  permission_required = *‘*appname.permission_name'
>>
>> This will limit to logged on users (as below), and also to users who possess 
>> this permission.
>>
>> Jim
>>
>>
>> On May 28, 2019, at 9:55 AM, Joe Reitman  wrote:
>>
>> Fellipe,
>>
>> Here is an example of decorating class based views from the documentation
>> 
>> :
>>
>> from django.contrib.auth.decorators import login_requiredfrom 
>> django.utils.decorators import method_decoratorfrom django.views.generic 
>> import TemplateView
>> class ProtectedView(TemplateView):
>> template_name = 'secret.html'
>>
>> @method_decorator(login_required)
>> def dispatch(self, *args, **kwargs):
>> return super().dispatch(*args, **kwargs)
>>
>>
>> On Tuesday, May 28, 2019 at 6:54:38 AM UTC-5, Fellipe Henrique wrote:
>>>
>>> Hello,
>>>
>>> I have these class, based on CreateView class... and I only want allow
>>> user with these permissions to add record...
>>>
>>> class ClienteCreateView(ERPbrViewMixin, CreateView):
>>> template_name = 'cadastro/cliente/form.html'
>>> permission_required = ('cliente.can_open', 'cliente.can_edit', 
>>> 'cliente.can_add')
>>> model = Cliente
>>> form_class = ClienteForm
>>>
>>> But, not working... user without these permission, when type the url
>>> show the form...
>>>
>>> Any tips how to do that?
>>>
>>> Cheers!
>>>
>>>
>>> T.·.F.·.A.·. S+F
>>> *Fellipe Henrique P. Soares*
>>>
>>> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
>>> 's/(.)/chr(ord($1)-2*3)/ge'
>>> *Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh
>>> *
>>> *Blog: *http:www.fellipeh.eti.br 
>>> *GitHub: https://github.com/fellipeh *
>>> *Twitter: @fh_bash*
>>>
>>
>> --
>> 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/060a2c59-bf39-456c-a686-bf6ba104e1f7%40googlegroups.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/B5E64E45-C1C3-455F-AEC7-167852FE17C7%40hotmail.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/CAF1jwZHCR%3Dn2FMcdPdWsAOKG7wQRhqKBb4is58P61dGCi8_Eqg%40mail.gmail.com
> 

problem with form

2019-05-30 Thread Saeed Pooladzadeh
Hi

I'm trying to make a simple crud applicatio and learn from it. I wonder why 
my form can't save the data. Here cames my view:

from django.shortcuts import render
from saeed.forms import SmodelForm  
from saeed.models import Smodel
from django.shortcuts import render, redirect  



# Create your views here.
def emp(request):  
if request.method == "POST":  
form = SmodelForm(request.POST)  
if form.is_valid():  
try:  
form.save()  
return redirect('/show')  
except  AssertionError as error:

print(error)
pass

 



else:  
form = SmodelForm()  
return render(request,'saeed/index.html',{'form':form})  
#
def show(request):  
smodels = Smodel.objects.all()  
return render(request,'saeed/show.html',{'smodels':smodels}) 
#

def edit(request, id):  
smodels = Smodel.objects.get(id=id)  
return render(request,'saeed/edit.html', {'smodels':smodels})  
#---

def update(request, id):  
smodels = Smodel.objects.get(id=id)  
form = SmodelForm(request.POST, instance = smodels)  
if form.is_valid():  
form.save()  
return redirect("/show")  
return render(request,'saeed/edit.html',{'smodels':smodels})  

#-
def destroy(request, id):  
smodels = Smodel.objects.get(id=id)  
smodels.delete()  
return redirect("/show")  






edit.html

  
  
  
  
Index  
{% load staticfiles %}
 {% load bootstrap4 %}
  
  
  
  
{% csrf_token %}  
  
  
  
  
  
Update Details  
  
   

  
User Id:  
  
  
  


User Name:  
  
  
  

  
User Password:  
  
  
  

  
Like A Day:  
  
  
  

  
  
  
Update  
  
   

  
Follow per Day:  
  
  
 
  
  
  
  


index.html
  
  
  
  
Index  
{% load staticfiles %} 
{% load bootstrap4 %}
  
 
 
  
  
{% csrf_token %}  
  
  
  
  
  
Enter Details  
  


User Id:  
  
  {{ form.eid }}  
  

  
User Login:  
  
  {{ form.elogin }}  
  

  
User password:  
  
  {{ form.epassword }}  
  

  
Lika A day:  
  
  {{ form.elikeDay }}  
  
  

   
User follow per day:  
  
  {{ form.efollowPerDay }}  
  
  


  
  
  
Submit  
  

  
  
  




show.html

  
  
  
  
Index  
{% load staticfiles %} 
{% load bootstrap4 %}
  
 
 
  
  
{% csrf_token %}  
  
  
  
  
  
Enter Details  
  


User Id:  
  
  {{ form.eid }}  
  

  
User Login:  
  
  {{ form.elogin }}  
  

  
User password:  
  
  {{ form.epassword }}  
  

  
Lika A day:  
  
  {{ form.elikeDay }}  
  
  

   
User follow per day:  
  
  {{ form.efollowPerDay }}  
  
  


  
  
  
Submit  
  

  
  
  



forms.py

from django import forms  
from saeed.models import Smodel 

class SmodelForm(forms.ModelForm):  
class Meta:  
model = Smodel  
fields = "__all__"  


models:

from django.db import models
from django.conf import settings


# Create your models here.
class Smodel(models.Model):

eid=models.AutoField(primary_key=True)
   # eid=models.IntegerField(default=0)
elogin = models.CharField(max_length=8) 
epassword= models.CharField(max_length=8) 
  
elikeDay=models.IntegerField(default=10)
efollowPerDay=models.IntegerField(default=10)


   
#esession = models.TextField()
class Meta:  
db_table = "saeed"  


urls.py

"""
Definition of urls for bot3.
"""
from django.conf.urls import include, url
from django.contrib import admin  
from django.urls import path  
from saeed import views  

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = [

  # path('', admin.site.urls, name='admin'),
 path('', views.show, name='index'),
   path('', views.emp, name='emp'),
  path('', views.show, name='show'),
path('', views.show, name='index'),

   # path('', views.emp, name='show'),
   # path('', views.emp, name='index'),

  # path('index', views.show), 
   # path('admin/', admin.site.urls),  
  path('emp', views.emp),  
path('show',views.show), 
   # path('index', views.emp), 


path('edit/', views.edit, name='edit'), 
path('update/', views.update, 

Re: reagrding "{% csrf_token %}"issue on my web site login module

2019-05-30 Thread Abdul Qoyyuum
When you run the application and test the login, what do you see in the 
devtool's Network tab? Did you see if csrf_token is null? How about 
document.cookie? Is that also null? Is the document.cookie being passed to 
csrf_token in other ways?

Lots of ways to complete this in Angular/jQuery/Ajax or otherwise is 
presented in this document: https://docs.djangoproject.com/en/2.2/ref/csrf/

-- 
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/38a443bb-26be-45e2-8707-f0f9bf6522ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Create a real small business website with Django as soon as possible!!

2019-05-30 Thread Abdul Qoyyuum
Then just use a CMS like https://wagtail.io/. Wagtail is built on top of 
Django and its enough to cover all of your requirements. But its 
recommended that you go through Django tutorial in the docs first before 
trying out Wagtail though.

On Saturday, May 25, 2019 at 3:30:56 AM UTC+8, Siavash Siavashi wrote:
>
> I am new to Django and I want to create a personal business site using 
> this platform. I should say that i have some experience working with python 
> and html.
> In general in my business , customers on home page click on the type of 
> services that they want.Next, they should register some information about 
> the  service interesting.The content of my site should be display as the 
> language that is  selected. Then , I would study the registered requests 
> and response them by email.If a costumer want to check her/his request, it 
> will be informed on website by a tracking number and a note that I write 
> down after processing that request(only a small note about the request 
> checking situation and that the result is emailed to the costumer email).
>
> I could design and create model and database for my website,but my main 
> problem is views and templates.So i have some questions:
> 1- Is there a sample project to use its views and templates for my website 
> ?
> 2- is it possible to use built-in admin app views and templates in my 
> website? how ?
> 2- how to change the language of my website content? is there a sample 
> project?
>
> Thanks alot
>

-- 
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/1b0e9d2a-dd4b-4424-99a6-0db503345f5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: is that any way to deploy django in apache with centos

2019-05-30 Thread Suresh Kannan
Hi,

I found this video helpful
https://www.youtube.com/watch?v=DzXCHAuHf0I=1553s but with Nginx and
Uwsgi.

Hope this helps you!

Suresh

On Thu, May 30, 2019 at 7:59 AM Kurosh Sol  wrote:

> is that any way to set Django in apache with wsgi mod  in centos
> I keep reading and still get error
> any good resource can really work?
>
> --
> 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/d041c339-201f-420b-a2b1-849016ae0b7a%40googlegroups.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/CANfVfcDo-vh6VHnoUSGDbr64pTxzbzSD_f1Lm_9GPTWKMf0hhA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: POINT OF SALE SYSTEM

2019-05-30 Thread Shakil Ahmmed
github/ShakilAhmmed/point_of_sale

On Thu, May 30, 2019, 5:45 PM pranayreddy788 
wrote:

> Easily
>
>
> On May 30, 2019 at 17:06, > wrote:
>
> Can a POS (point of sale) software be made in Django?
> 
>
> --
> 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/319b2899-cb41-474b-80c9-25aeab6b50d3%40googlegroups.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/CANjRyE0Jg5iACYktgHRCaiCqzMzY8shRgFTm%2BbJp7xDv3VhS2Q%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/CA%2BEpJfz4pnAL4ZtQ-qjnoiz-2K5yMJcMzmmatwJ_q88ZWM44Hg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


is that any way to deploy django in apache with centos

2019-05-30 Thread Kurosh Sol
is that any way to set Django in apache with wsgi mod  in centos
I keep reading and still get error 
any good resource can really work?

-- 
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/d041c339-201f-420b-a2b1-849016ae0b7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: POINT OF SALE SYSTEM

2019-05-30 Thread pranayreddy788
Easily


On May 30, 2019 at 17:06, > wrote:

Can a POS (point of sale) software be made in Django?


-- 
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/319b2899-cb41-474b-80c9-25aeab6b50d3%40googlegroups.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/CANjRyE0Jg5iACYktgHRCaiCqzMzY8shRgFTm%2BbJp7xDv3VhS2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


POINT OF SALE SYSTEM

2019-05-30 Thread Muhammed Bilal
Can a POS (point of sale) software be made in Django? 


-- 
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/319b2899-cb41-474b-80c9-25aeab6b50d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: SFTP (Secure File Transfer Protocol )

2019-05-30 Thread Kasper Laudrup

Hi Vkash,

On 30/05/2019 10.32, Vkash Poudel wrote:
How can I create the  SFTP (Secure File Transfer Protocol ) app in 
Django.I have been researching but couldnt find any documentation.Or may 
bi I am confused.HELP me out with this problem.I need a simple example 
of SFTP in django or If you can provide me some usefull links or 
examples.Please reply my mail.


If I understand correctly, you do seem to be a bit confused. May I ask 
what you are trying to achieve?


Django is a web framework meaning that it's using the HTTP protocol 
which is itself an application layer protocol. SFTP is another 
application layer protocol so you cannot really implement that in Django.


There is at least one implementation of SFTP in Python though:

https://www.paramiko.org/

But of course, that has absolutely nothing to do with Django.

So again, maybe start out by telling us what you really want to achieve?

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To 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/fae2ef93-105a-b060-4364-72bde5b64a15%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.


context must be a dict rather than RequestContext.

2019-05-30 Thread Soumen Khatua
Hi Folks,
I'm using django 1.11 for this project I'm implementing payment gateway of
PayuMoney but I'm getting thios error:

context must be a dict rather than RequestContext.



I alreday attach the source code,please let me know what i missed in this
code.

-- 
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/CAPUw6Wb82bGpky2zsUpG2SKcnaaJ7dXeaNafuYKpD0QwF6m6Kw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
from django.shortcuts import render, render_to_response
from django.http import HttpResponse,HttpResponseRedirect
from django.template.loader import get_template
from django.template import Context, Template,RequestContext
import datetime
import hashlib
from random import randint
from django.views.decorators.csrf import csrf_protect, csrf_exempt
from django.views.decorators import csrf

def payment(request):
MERCHANT_KEY = ""
key=""
SALT = ""
PAYU_BASE_URL = "https://sandboxsecure.payu.in/_payment;
action = ''
posted={}
# Merchant Key and Salt provided y the PayU.
for i in request.POST:
posted[i]=request.POST[i]
hash_object = hashlib.sha256(b'randint(0,20)')
txnid=hash_object.hexdigest()[0:20]
hashh = ''
posted['txnid']=txnid
hashSequence = 
"key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10"
posted['key']=key
hash_string=''
hashVarsSeq=hashSequence.split('|')
for i in hashVarsSeq:
try:
hash_string+=str(posted[i])
except Exception:
hash_string+=''
hash_string+='|'
hash_string+=SALT
hashh=hashlib.sha512(hash_string.encode('utf-8')).hexdigest().lower()
action =PAYU_BASE_URL
if(posted.get("key")!=None and posted.get("txnid")!=None and 
posted.get("productinfo")!=None and posted.get("firstname")!=None and 
posted.get("email")!=None):
return 
render_to_response('paymant/payment_form.html',RequestContext(request,{"posted":posted,"hashh":hashh,"MERCHANT_KEY":MERCHANT_KEY,"txnid":txnid,"hash_string":hash_string,"action":"https://test.payu.in/_payment;
 }))
else:
return 
render_to_response('paymant/payment_form.html',RequestContext(request,{"posted":posted,"hashh":hashh,"MERCHANT_KEY":MERCHANT_KEY,"txnid":txnid,"hash_string":hash_string,"action":"."
 }))



@csrf_protect
@csrf_exempt
def payment_success(request):
c = {}
c.update(csrf(request))
status=request.POST["status"]
firstname=request.POST["firstname"]
amount=request.POST["amount"]
txnid=request.POST["txnid"]
posted_hash=request.POST["hash"]
key=request.POST["key"]
productinfo=request.POST["productinfo"]
email=request.POST["email"]
salt="X"
try:
additionalCharges=request.POST["additionalCharges"]

retHashSeq=additionalCharges+'|'+salt+'|'+status+'|||'+email+'|'+firstname+'|'+productinfo+'|'+amount+'|'+txnid+'|'+key
except Exception:
retHashSeq = 
salt+'|'+status+'|||'+email+'|'+firstname+'|'+productinfo+'|'+amount+'|'+txnid+'|'+key
hashh=hashlib.sha512(retHashSeq).hexdigest().lower()
if(hashh !=posted_hash):
print("Invalid Transaction. Please try again")
else:
print("Thank You. Your order status is ", status)
print("Your Transaction ID for this transaction is ",txnid)
print("We have received a payment of Rs. ", amount ,". Your order will 
soon be shipped.")
return 
render_to_response('sucess.html',RequestContext(request,{"txnid":txnid,"status":status,"amount":amount}))



@csrf_protect
@csrf_exempt
def payment_failure(request):
c = {}
c.update(csrf(request))
status=request.POST["status"]
firstname=request.POST["firstname"]
amount=request.POST["amount"]
txnid=request.POST["txnid"]
posted_hash=request.POST["hash"]
key=request.POST["key"]
productinfo=request.POST["productinfo"]
email=request.POST["email"]
salt=""
try:
additionalCharges=request.POST["additionalCharges"]

retHashSeq=additionalCharges+'|'+salt+'|'+status+'|||'+email+'|'+firstname+'|'+productinfo+'|'+amount+'|'+txnid+'|'+key
except Exception:
retHashSeq = 
salt+'|'+status+'|||'+email+'|'+firstname+'|'+productinfo+'|'+amount+'|'+txnid+'|'+key
hashh=hashlib.sha512(retHashSeq).hexdigest().lower()
if(hashh !=posted_hash):
print("Invalid Transaction. Please try again")
else:
print("Thank You. Your order status is ", status)
print("Your Transaction ID for this transaction is ",txnid)

jquery deployment

2019-05-30 Thread Mike Dewhirst
I just encountered a weird UI glitch[1] in the Admin after upgrading to 
Django 2.2.1


I checked and found the version of jquery I'm using is 1.4.1 and figured 
that has to be contributing to the problem.


The 2.1 release note says "jQuery is upgraded from version 2.2.3 to 
3.3.1." so I dug deeper in the docs to find how it is upgraded. Can't 
find anything so far. I saw that there are Django Admin javascript 
customisations. So that might complicate matters.


Is there a best practice for ensuring I keep my projects up to date?

Thanks

Mike

[1] With a m2m (self) adding another instance clicking on the {SHOW} 
link just relocates to the top of the page. Has to be a jQuery thing 
doesn't it?


--
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/dabf69c9-996b-da51-3605-ff7a9aaacde9%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Django wsgi apache Deploy project

2019-05-30 Thread N'BE SORO
 thank you everyone I managed the deployment

Le mar. 7 mai 2019 à 18:48, Subhodeep Das  a
écrit :

> Try:
>
> WSGIScriptAlias /test/tc-test /var/www/stage/hello/tc-test/django.wsgi
>
> You shouldn't have trailing slash on first argument.
>
> On Tue, May 7, 2019 at 7:27 PM N'BE SORO  wrote:
>
>>
>> Hi I'm a beginner in python and I realized a project in Django. I have
>> problems in hosting my project. here is my code in the 000-default.conf
>>  #ServerName #ServerAlias ServerAdmin webmaster @
>> localhost DocumentRoot / var / www / html / ecommerce WSGIScriptAlias ​​/
>> /var/www/html/ecommerce/ecommerce/wsgi.py WSGIPythonPath / var / www / html
>> / ecommerce / ErrorLog $ {APACHE_LOG_DIR} /error.log CustomLog $
>> {APACHE_LOG_DIR} /access.log combined  and I have this error
>> Invalid command 'WSGIScriptAlias / /var / www / html / ecommerce /
>> ecommerce / wsgi.py ', perhaps misspelled or d efined by a module not
>> included in the server configuration
>>
>> --
>> 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/1912bcdc-cb2f-45a2-932c-d579eb944c0a%40googlegroups.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/CAJEaip7ZtWWZW--O9Z2nqvVypwLe8CMRVSPboc28yoNkaLMV%3Dg%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/CAOtSHp--MqaZPhUZiPUgBdBEMp%2B2F0Mm_uQHJ%2But1_qHh75d4A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing request from form

2019-05-30 Thread James Schneider
I always dread being the guy that responds to his own thread with "Hey
guys, I fixed it."

At any rate, I'm currently stuck having to create relatively empty
> ModelForm shell classes for the simple reason of including a form mixin
> that grabs the request before __init__() (because the ModelForm complains
> if I don't), and overrides save() to save the fields with the user object,
> in addition to specifying the form_class in the CBV along with a view mixin
> for sending the request over via get_form_kwargs(). It's quite a process,
> especially when dealing with multiple models. I could drop a significant
> amount of code if I could flag the CBV to include the request with the form
> initialization. Heck, there could even be some magic to have the form
> associate the user with specific fields on save from the view as
> form_kwargs.
>
> Or am I making things hard on myself? Thanks.
>

For the use case above, I had an epiphany did some more experimenting and
figured out how to update the audit fields without needing to mangle a
Form/ModelForm, entirely from the CBV:

 def form_valid(self, form):
form.instance.updated_by = self.request.user
return super().form_valid(form)

Fully compatible with an implicit ModelForm, and only 3 lines of code!

This is an easy drop in a view mixin, which I already have for other
overrides anyway. However, this feels really gross, and I feel like I'm
violating some prime directive by attaching data to an instance that was
not validated by the form. I think I can forgive myself since the data I'm
attaching is coming from Django and not some other source, and I have to
assume Django handles these things properly.

Of course while writing this message, I then stumbled on this exact
solution buried in the Django docs:

https://docs.djangoproject.com/en/dev/topics/class-based-views/generic-editing/#models-and-request-user

So, feel free to ignore me. I will grant myself a point for coming up with
the same solution already blessed by the Django devs. I'm also deducting a
point from myself for not RTFM properly, so I break even.

-James

-- 
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/CA%2Be%2BciVKk6V6gpwF5FW8%3D-1ib%3D-xj6UX4-cceL3Fco12BpkfUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


SFTP (Secure File Transfer Protocol )

2019-05-30 Thread Vkash Poudel
How can I create the  SFTP (Secure File Transfer Protocol ) app in Django.I 
have been researching but couldnt find any documentation.Or may bi I am 
confused.HELP me out with this problem.I need a simple example of SFTP in 
django or If you can provide me some usefull links or examples.Please reply 
my mail.
bikashpoud...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To 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/8e945bb5-f1ef-4111-850f-a9cf44410d38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Accessing request from form

2019-05-30 Thread James Schneider
Does anyone know a philosophical reason (or I suppose a technical one,
although I don't think that's the case) why the request is not made
available by default in ModelForms when using CBV's?

Almost all of the models I use have "audit" fields (created_by, updated_by,
etc.) that reference the current logged in user. A ModelForm has no access
to the current request, and as such can't update these fields without a
User object. I have other use cases as well, but this one is probably the
most prevalent among other developers.

At any rate, I'm currently stuck having to create relatively empty
ModelForm shell classes for the simple reason of including a form mixin
that grabs the request before __init__() (because the ModelForm complains
if I don't), and overrides save() to save the fields with the user object,
in addition to specifying the form_class in the CBV along with a view mixin
for sending the request over via get_form_kwargs(). It's quite a process,
especially when dealing with multiple models. I could drop a significant
amount of code if I could flag the CBV to include the request with the form
initialization. Heck, there could even be some magic to have the form
associate the user with specific fields on save from the view as
form_kwargs.

Or am I making things hard on myself? Thanks.

-James

-- 
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/CA%2Be%2BciVd5nZtMXNU2UUgvxCUXmmzKU4UAnkSRXzFffS3QBGbHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.