Re: python django fields and row calculation

2018-06-11 Thread ijazz jazz
In short, a model's manager is an object through which Django models perform 
... (For row-level functionality – i.e., functions that act on a single 
instance of a model object ... This has a single method, title_count() , 
which does the calculation.


Best Python Training in Chennai 


-- 
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/39949ce2-4cc6-41e2-acf7-68c484c19c04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Produces Python?

2018-06-11 Thread ijazz jazz
Django was born in a newsroom, and it's designed to handle that . With a 
simple command, Djangoautomatically generates a Python API based .


Best Python Training in Chennai 


-- 
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/273d96dc-313d-42c8-94ba-8ae6d3bcad99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python / Django slow ? Deciding my next technological stack

2018-06-11 Thread ijazz jazz
he appropriate tech stack is crucial for a successful web application. ... 
Ruby (Ruby on Rails); Python(Django, Flask, Pylons); PHP (Laravel); Java 
 Needless to say, removing all bugs requires a lot of time and slows down 
development.


Best Python Training in Chennai 


-- 
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/334f687c-9d19-4258-966e-0864622fdeb0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Python Training in Chennai

2018-06-11 Thread ijazz jazz
we are focused on imparting a One-to-One Python Training in Chennai, our 
trainees get to acquire a lot from the course. Our Fast-Track Python 
Training in Chennai also ensures that they learn the most within the least 
possible time. Here are the major topics we cover under this Python course 
Syllabus Introduction, Memory management and Garbage collections, 
Statements and Syntax, File Operations, Functions, Modules and Packages, 
Classes, Exception Handling, Advanced Concepts and Django. 

Python Training in Chennai 


-- 
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/3b938430-147e-478a-ad35-589c1b1a4227%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Interfaz administrativa, login con SSH

2018-06-11 Thread Frank Mascarell
Gracias por vuestras recomendaciones de seguridad, muy interesantes.
Después de recapacitar con todo esto, me planteo lo siguiente; si estamos 
desarrollando una tienda online,
donde la base de datos se encuentra en un host remoto, y los 
administradores de la tienda deben
entrar en ella diariamente, con todos los permisos (CRUD), ¿ la máxima 
seguridad que se puede
implementar para la interfaz administrativa es mediante la autenticación de 
dos pasos ?
¿ No hay otra forma de hacerlo ? Por ejemplo, podría crear un programa en 
Python, utilizando
la librería Paramiko para conectarme via SSH, y después ejecutar el comando 
que puede llamar
al mismo tiempo a otro programa personalizado en el servidor, que abriría 
una ventana de navegador
con la interfaz administrativa, si la autenticación es correcta.
¿alguna idea mejor? 

-- 
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/ad384adf-4b44-4e3b-9beb-daff67458ca6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Redirect causing Error in Safari

2018-06-11 Thread Dario Heinisch
Hey Guys, 

Hope you all are doing well.

I have encountered a weird bug and I am not sure which components fault it is, 
I assume something in settings.py.

I have moved from Heroku to my own Debian-Server with my Django Channels App.

When I access my App over my computer with chrome everything works fine.

When I access my app over my computer with Safari only those site works which 
don’t have an internal Redirect - HttpResponseRedirect(reverse(url)). While on 
iPhone I get an Protocol Error, on my computer I get an NSPOSIXErrorDomain:100 
Error. Also if I try it on iPhone with the chrome browser from the App Store it 
does not work. 

Android users don’t have any issues.

Then I downloaded Andrew Godwin's Multichannels repo and tried it with my 
ssl-keys. It worked fine (login has a redirect, so I know it works), login on 
my app does neither work using Safari nor an iPhone/Ipad.

I am starting Daphne as following: 
daphne -b 0.0.0.0 -e 
ssl:8080:privateKey=/home/tsg/privkey.pem:certKey=/home/tsg/fullchain.pem 
share_game.asgi:application

Do you have any idea what could cause this bug or have you encountered this or 
something similar before?

Here is my settings.py: https://dpaste.de/HHBz# 

Also I am not using Nginx.

I tried this http://timsloan.net/2007/05/safari-and-django-redirects/ 
 but it did not solve 
my problem.

And here is my site: https://www.thesharegame.com/welcome/ 


Click on the ‘house-icon’ in the navbar to test it out.

Many thanks in advance.

Best regards,
Dario

-- 
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/3CD2CE34-BE68-46E5-9B2B-7929150239F0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


using modals for forms....

2018-06-11 Thread Alexander Joseph
I've tried every tutorial on how to use modals with forms in django and 
have basically got nowhere.

The latest one I tried is this one
https://dmorgan.info/posts/django-views-bootstrap-modals/

I seem to be running into the same problem with them though, which is I'm 
not sure where to put the code for the modal.

In my list view I have the button for the modal which looks like...

  Add


But one of my problems is I'm not sure where to put the actual modal code 
and/or if I need to split up the modal code. I'm using class based views 
and this is going to be a form for a create view.

When I put the code for the modal shell in the list view as well (btw here 
is my modal shell) ...

  

  
Modal title

  ×

  
  
...
  
  
Close
Save changes
  


  
  



obviously the modal pops up fine and displays the "..." in the body

But I have found no way in all the tutorials to even display the form in 
the modal, much less handle the ajax submitting of the form. Does anyone 
have a better tutorial or can give me direction?? 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/d1230b14-6b34-4b9f-8712-43fa2721d938%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Passing Django Template Vars to JS

2018-06-11 Thread Melvyn Sopacua
On maandag 11 juni 2018 20:11:36 CEST Simon Connah wrote:

> I like the idea of the custom attribute. I'll do that then.

The common way is to use a data- attribute[1].
-- 
Melvyn Sopacua


[1] https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/
Use_data_attributes

-- 
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/2026797.eeRFsSjbx6%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: Passing Django Template Vars to JS

2018-06-11 Thread Simon Connah
Hi Vijay,

Thank you very much for the reply and sorry for the late reply.

You are completely right about not having multiple elements with the
same ID. I completely forgot that an ID was meant to be unique on a
page. I'll change it to a class.

I like the idea of the custom attribute. I'll do that then.

Simon.
On Mon, 11 Jun 2018 at 02:04, Vijay Khemlani  wrote:
>
> I'm not sure why your code does not work (maybe there is a "race condition" 
> between the JS click handlers), but that global variable is a bad idea in 
> general.
>
> You can add the comment ID as an attribute to your button, like
>
> 
>
> and in your event handler obtain the comment id
>
> $("#like_comment_button").click(function (event) {
>var comment_id = event.target.getAttribute('data-comment-id')
>// Call AJAX
> })
>
> That way you don't need the global variable or the other click handler
>
> Finally, it's a bad idea to have multiple elements with the same ID (all 
> comments will have a button with ID "like_comment_button") so it's better to 
> add it as a class rather than an id.
>
> Regards
>
>
>
>
>
> On Sun, Jun 10, 2018 at 11:19 AM Simon Connah  wrote:
>>
>> I know that the standard way to do this is to create a script tag with
>> a global JS variable in your Django template before you import your
>> other JS files but that won't work for my current situation.
>>
>> I have an article detail view which is a single model instance. But I
>> also have a list of comment objects that have a Foreign Key to the
>> article (because that is the article that is being commented on).
>>
>> I need to pass the comment_id to the JS files that I am loading. If
>> you want to see the code I am using then you can see it here:
>>
>> https://gitlab.com/glamorous-systems/seductive/blob/master/blog/templates/blog/article_detail.html
>>
>> I thought I'd use an onclick event on the Like / Dislike button to
>> call a JS function which then passes that value to this JS file:
>>
>> https://gitlab.com/glamorous-systems/seductive/blob/master/blog/static/js/pass_comment_id.js
>>
>> and then I'd just call the return_comment_id() function from my other
>> JS files to get the comment_id of the specific comment the user
>> clicked the Like / Dislike button for. I think the problem is that my
>> jQuery AJAX selectors are also looking for a click event, so they
>> happen in a strange order, but I'm not sure.
>>
>> I'm totally lost on what I should be doing here. Any help would be
>> very much appreciated :).
>>
>> --
>> 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/CADNsu1OksTqc2crvX%3DK%3D_Kf_Xz1fCfABTRV-q48htRUikiAtXA%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/CALn3ei0ZneJzKAbSyN958_1RCaS7kjQY6VszQb8a%3D-Mxgod-GQ%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/CADNsu1PL7dT%2BhXgMc8r9arVZY2pXYxP8hQWywn5u8OqSKaBLHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble with sqlite

2018-06-11 Thread Daniel Hepper
The SQLite file does not contain any Python code, it contains the database.
It is stored in a binary format which you can't look at with a text editor.

You will need a special program to look at the contents of this file, a
quick Google search brings up https://sqlitebrowser.org/

Hope that helps,
Daniel



On Mon, Jun 11, 2018 at 5:03 PM, Mickey Mouse 
wrote:

>
> I am beginner with Django and I'm using PyCharm IDE. I was watching a
> tutorial following along when I noticed my sqlite file that comes with
> Django had a question mark next to it (the guy in the video didnt have
> that). So I clicked it and it prompted me to associate my sqlite file with
> a certain file type. To experiment I selected the python(.py) file type.
> Now when I open up I get an error with corrupt code (or at least that's how
> it looks to me. The error is "File was loaded in the wrong encoding:
> 'UTF-8.'
>
> When I click on that error message I am able to select from dozens of
> different encodings. I'm assuming that's the issue but I don't know for
> sure. Does anybody have a solution to this issue. 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/12d4e693-7e03-4053-946a-e9a5a08440b8%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/CAHEnUVUVQr_ujYYR_Tq2aNUXF01OYjxdF9Nwc4aHXGVgMkXUFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Trouble with sqlite

2018-06-11 Thread Mickey Mouse

I am beginner with Django and I'm using PyCharm IDE. I was watching a tutorial 
following along when I noticed my sqlite file that comes with Django had a 
question mark next to it (the guy in the video didnt have that). So I clicked 
it and it prompted me to associate my sqlite file with a certain file type. To 
experiment I selected the python(.py) file type. Now when I open up I get an 
error with corrupt code (or at least that's how it looks to me. The error is 
"File was loaded in the wrong encoding: 'UTF-8.'

When I click on that error message I am able to select from dozens of different 
encodings. I'm assuming that's the issue but I don't know for sure. Does 
anybody have a solution to this issue. 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/12d4e693-7e03-4053-946a-e9a5a08440b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need to Add One Or More Fields in Signup

2018-06-11 Thread Dan Nepejchal
Hi,
I think you must define your own user model, with inherit from django user
model...
class User(AbstractUser): bio = models.TextField(max_length=500, blank=True)
location = models.CharField(max_length=30, blank=True) birth_date = models.
DateField(null=True, blank=True)

and settings:
AUTH_USER_MODEL = 'core.User'

source:
https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html

po 11. 6. 2018 v 16:37 odesílatel Pravin Yadav  napsal:

> Hello,
>
> I want to add the one or more fields in User Models/Table.
> Kindly let me know about this module.
>
> My code below:-
>
> def register(request):
>
> if request.method == 'POST':
> first_name = request.POST['first_name']
> last_name = request.POST['last_name']
> email = request.POST['email']
> password = request.POST['password']
> username= str(first_name).lower() + str(last_name).lower()
> userdatalist = User.objects.filter(email=email).count() or
> User.objects.filter(username=username).count()
> if userdatalist == 0:
> new_user = User.objects.create_user(
> username= email,
> first_name=first_name,
> last_name=last_name,
> email=email,
> password=password,
> is_active=0,
> age=age
> )
> hostname = request.get_host
> context = {'first_name': first_name, 'last_name': last_name, 'pk':
> new_user.id, 'hostname': hostname}
> to_email = email
> from_email = 'VideoWithFriends'
> html_message = render_to_string('mails/useractivation.html', context)
> subject = 'Your account has been created successfully.'
> email = EmailMultiAlternatives(subject, html_message, from_email,
> [to_email])
> email.attach_alternative(html_message, "text/html")
> if(email.send()):
> success = 1
> return HttpResponse(success);
> else:
> success = 2
> return HttpResponse(success);
> else:
> error = 0
> return HttpResponse(error);
>
> I haven't created any model of User. I have called the predefined models
> of User.
> When i'm adding extra fields like (age). it's showing errors.
> kindly let me how  it will be fixed.
>
>
> Thanks,
> Pravin Yadav
>
> --
> 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/05199455-aad3-4390-ac93-d902f2361680%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/CADS85tyidM_fBZPw9CjDxYp3i%3DjoAZRLko5GB5h3%2BN-K52D8Mw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Need to Add One Or More Fields in Signup

2018-06-11 Thread Pravin Yadav
Hello,

I want to add the one or more fields in User Models/Table.
Kindly let me know about this module.

My code below:-

def register(request):

if request.method == 'POST':
first_name = request.POST['first_name']
last_name = request.POST['last_name']
email = request.POST['email']
password = request.POST['password']
username= str(first_name).lower() + str(last_name).lower()
userdatalist = User.objects.filter(email=email).count() or 
User.objects.filter(username=username).count()
if userdatalist == 0:
new_user = User.objects.create_user(
username= email,
first_name=first_name,
last_name=last_name,
email=email,
password=password,
is_active=0,
age=age
)
hostname = request.get_host
context = {'first_name': first_name, 'last_name': last_name, 'pk': 
new_user.id, 'hostname': hostname}
to_email = email
from_email = 'VideoWithFriends'
html_message = render_to_string('mails/useractivation.html', context)
subject = 'Your account has been created successfully.'
email = EmailMultiAlternatives(subject, html_message, from_email, 
[to_email])
email.attach_alternative(html_message, "text/html")
if(email.send()):
success = 1
return HttpResponse(success);
else:
success = 2
return HttpResponse(success);
else:
error = 0
return HttpResponse(error);

I haven't created any model of User. I have called the predefined models of 
User.
When i'm adding extra fields like (age). it's showing errors.
kindly let me how  it will be fixed.


Thanks,
Pravin Yadav

-- 
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/05199455-aad3-4390-ac93-d902f2361680%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Reusable Code like Helper OR Component.

2018-06-11 Thread Pravin Yadav


Hello,

I have created the websites in Python 3.6 and Django 2.0.6. I have created 
separate the header.html, footer.html, index.html & base.html.  I want to 
create the reusable code like Helper OR Component. I have no idea about 
this how to create the helper or component. if any one know abut this 
kindly let me know.


Thanks,

Pravin Yadav

-- 
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/a920009c-ca15-4fe4-a146-26cfddef809b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with get_absolute_url() in admin

2018-06-11 Thread Joakim Hove
Thank you;

my main problem was with the sites model - and the default value for
SITE_ID == 1. I had no intention of hardcoding the URL.

On Mon, Jun 11, 2018 at 12:58 AM Anthony Anonde  wrote:

> the example.com is am example django give for Site. Which means there is
> a way for you to manage more than one site at a time, basically using the
> site_id.
> To you Questions, i don't understand why you want to hard code your uri
> routing like that when you can easily use the app_name and name convention
> which is more dynamic then hard coding it like that:
> for example at the model Transaction urls.py
> app_name = "trans"
> url(r'(?P-/d+)$', views.func, name='account_trans'),
>
> def get_absolute_url(self):
> return reverse("trans:account_trans",  kwargs={"pk":self.pk})
>
>
> and you will be just fine hope this help
>
>
>
> On Sunday, June 10, 2018 at 12:30:51 PM UTC+1, Joakim Hove wrote:
>>
>> Hello,
>>
>> I have a model `Transaction` which can be viewed at the url:
>> /transaction/view/$ID/ - if I just enter that url in the browser, or in
>> template everything works. But when I have the following get_abolute_url()
>> method:
>>
>> def get_absolute_url(self):
>>  return "/transaction/view/{}/".format( self.id )
>>
>> things do not work from the Admin. When I click on the "View on Site"
>> link i am redirected to "http://example.com/transaction/view/23635/; and
>> I get an error message about failed XML parsing. I have no clue where the "
>> example.com" address comes from - that string is not in my codebase. If
>> I hardcode the get_absolute_url to:
>>
>> def get_absolute_url(self):
>>  return "http://127.0.0.1:8000/transaction/view{}/".format(self.id)
>>
>> That works in development, but needless to say that is not a very good
>> approach.
>>
>> I am on Django 1.10
>>
>>
>> Regard Joakim
>>
>>
>> --
> 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/5678b297-2693-4ae8-b249-08e42713ebf7%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/CALKD1M_diEj6K9Mw7kPAvrjWs6JUjE1H0-zgB-0M8VFKSDVq%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Redirecting django app webpages through celery task

2018-06-11 Thread Jason
1, you can't.  you can expose an URL and view for your client-side app to 
request for task state.  if response of state is "SUCCESS", then you can 
trigger a client side redirect.
2. when using celery, pass in only the data it's needed, such as a db 
record ID, and do all your retrievals inside the task.

Some reading for celery best practices:

https://denibertovic.com/posts/celery-best-practices/
https://blog.balthazar-rouberol.com/celery-best-practices
https://khashtamov.com/en/celery-best-practices-practical-approach/

On Monday, June 11, 2018 at 9:14:42 AM UTC-4, Mohammed Noor wrote:
>
> Hello guys,
>
> I need to create  a django application that takes a repository url, builds 
> the code located in the url location and runs a few tests. If the tests are 
> successfull, it tags the code and then sends an email to the user notifying 
> the same. 
>
> Because the building process takes a long time, I have used celery to run 
> it as a background process. I am implementing the following design.
>
> def main_function(request):
>   # lines_of_code
>   result=tasks.BuildCodeAndVerify.delay(args)
>   #few more lines of code
>   return (request,'waiting_page.html',context)
>
> Note: The waiting page has a progress bar that reads percentage progress 
> from my celery task i.e BuildCodeAndVerify. 
>
> *Now, I am facing two problems:*
>
> 1. If the build is successful, i need to redirect from the waiting page 
> and update the html view with a success page and a summary of the build. 
> How do i make the celery task redirect a webpage? Also, it needs to pass 
> a dictionary to the webpage containing a summary. How do i do all this?
>
> 2. Is it possible to pass the request object as an argument like  
> BuildCodeAndVerify(request,other_args). Because whenever I try i get an 
> error saying. "WSGI error: type object is not JSON serializable." 
>
>
> And I have very limited django and python knowledge so please go easy on 
> me if my questions look naive. 
>
> Would be grateful for any help and advice i can get.
>
> Thanks a lot!
> Khasim
>
>

-- 
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/2c43e673-d203-4a78-882f-1723c9c9bd0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Redirecting django app webpages through celery task

2018-06-11 Thread Mohammed Noor
Hello guys,

I need to create  a django application that takes a repository url, builds
the code located in the url location and runs a few tests. If the tests are
successfull, it tags the code and then sends an email to the user notifying
the same.

Because the building process takes a long time, I have used celery to run
it as a background process. I am implementing the following design.

def main_function(request):
  # lines_of_code
  result=tasks.BuildCodeAndVerify.delay(args)
  #few more lines of code
  return (request,'waiting_page.html',context)

Note: The waiting page has a progress bar that reads percentage progress
from my celery task i.e BuildCodeAndVerify.

*Now, I am facing two problems:*

1. If the build is successful, i need to redirect from the waiting page and
update the html view with a success page and a summary of the build. How do
i make the celery task redirect a webpage? Also, it needs to pass a
dictionary to the webpage containing a summary. How do i do all this?

2. Is it possible to pass the request object as an argument like
BuildCodeAndVerify(request,other_args). Because whenever I try i get an
error saying. "WSGI error: type object is not JSON serializable."


And I have very limited django and python knowledge so please go easy on me
if my questions look naive.

Would be grateful for any help and advice i can get.

Thanks a lot!
Khasim

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


Re: Interfaz administrativa, login con SSH

2018-06-11 Thread Vijay Khemlani
"Vijay, thanks for the help, but the authentication of two factors seems
quite uncomfortable, considering that an administrator can enter every day,
several times a day, having to depend on a mobile device for each login.
"

Session cookies last for 2 weeks by default in Django, regardless of the
login method

On Sun, Jun 10, 2018 at 11:31 PM carlos  wrote:

> Hola, tambien te recomiendo que leas esto
> Hi, i also recommend you read this
>
> https://hackernoon.com/5-ways-to-make-django-admin-safer-eb7753698ac8
>
>
> On Sun, Jun 10, 2018 at 8:02 PM Frank Mascarell <
> frank_mascar...@gandiweb.com> wrote:
>
>> Vijay, thanks for the help, but the authentication of two factors seems
>> quite uncomfortable, considering that an administrator can enter every day,
>> several times a day, having to depend on a mobile device for each login.
>>
>> I have to rethink the problem, perhaps by directly accessing postgres,
>> through
>> SSH with a GUI for the client-user that includes a CRUD interface,
>> although I do not have
>> knowledge of the software available for this. I have to investigate what
>> other ways I can
>> identify myself to a postgress database with SSH.
>>
>> Greetings.
>>
>> --
>> 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/05cc0a47-79e8-4088-b54f-15d9d098c514%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> att.
> Carlos Rocha
>
> --
> 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/CAM-7rO0B1Qk%3DO6o8kwFv1UdxGFMxYg-eKbOb5VAwkj6XHfWvGQ%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/CALn3ei2WkhJ%3DhvuZ0Z3GnepUqk4X9wpBbzL_40OHQ1mH%2BzQLmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to execute a python(selenium) script on clicking run button in the template view. Django

2018-06-11 Thread Julio Biason
Hi Dimple,

Your `url` is invalid. Views are exposed to the world via urls; in that,
you define which URL will call which view.

If you're running Django on your machine, your URL should probably start
with 'http://localhost:8000/the/url/for/your/view' -- although the `http`
can be omitted, in which case the browser will use the current schema and
`://localhost` can also be omitted, in which case the browser will request
from the current server.

On Mon, Jun 11, 2018 at 6:43 AM, Dimple Mathew 
wrote:

> *Once i select options in the drop-down, the scripts should be executed.*
> *Index.html*
>
>  
> 
> US BANK
> BOKF
> COMMERCE BANK
> MICHIAS
> TD BANK
> WELSFARGO
> BOA
> 
> 
> 
>
>
>  

How to execute a python(selenium) script on clicking run button in the template view. Django

2018-06-11 Thread Dimple Mathew
*Once i select options in the drop-down, the scripts should be executed.*
*Index.html*

 

US BANK
BOKF
COMMERCE BANK
MICHIAS
TD BANK
WELSFARGO
BOA





 

Django + Webpack + Heroku. Error reading /app/webpack-stats.json. Are you sure webpack has generated the file and the path is correct?

2018-06-11 Thread Audi Quattro 1992
Hello! I have some issue with my project Django+Webpack. I spend a lot of 
time to correct my path STATS_FILE with webpack.config.js, but nothing help 
me. My project work locally perfect, but when i want to open him on Heroku 
or AWS i have this issue: "Error reading /app/webpack-stats.json. Are you 
sure webpack has generated the file and the path is correct?". What is 
wrong? Here is my HOST = "https://safe-everglades-60488.herokuapp.com/;. I 
do this with AWS and Heroku, but i cant decided this issue. In my question 
on stackoverflow more infomation about my 
project: 
https://stackoverflow.com/questions/50642163/aws-djangoreact-oserror-opt-python-current-app-webpack-stats-json.
 I've 
spent so much time solving this issue... Any helpful advices would be great 
for me. Thanks you for attention and waste of time...

-- 
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/b4cf3b5f-13ea-4112-bf33-139d51bc2ef7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.