Re: Question about form_valid: how to automatically set multiple fields when users input data via CreateView supported form?

2019-04-29 Thread Atsunori Kaneshige
Hi, Britto,

Sorry for my late reply.
Thank you so much!
I learnt a lot.

Looks like you created a function called get_context_data and put all 
comment data from Comment database into context with key 'comments'.
You then called 'comments' in the template. Now I don't need 
reated_name='comment' in models.py

To upload images, MEDIA_URL and MEDIA_ROOT are configured in settings.py 
and urls.py
image field is added accordingly in models.py

Thank you very much!
I will keep adding features to make my first blog app!

Best regards,

Nori



On Monday, April 29, 2019 at 11:12:08 AM UTC-4, SimpleHumble wrote:
>
> Find attached final version with image upload too. You need to pip install 
> pillow this to work.
>
>
> Regards
> Britto
>
>
> On Mon, 29 Apr 2019 at 16:17, Britto . > 
> wrote:
>
>> Find attached zip for the comments version. Added comments to context of 
>> ListView then displayed it in template.
>> Always think about Function Based View first then convert it to Class 
>> Based View, it would help you learn well.
>>
>>
>> Regards
>> Britto
>>
>>
>> On Mon, 29 Apr 2019 at 03:45, Atsunori Kaneshige > > wrote:
>>
>>> Hi, Britto,
>>>
>>> Let me attach current looking.
>>> Now I am trying to display all related comments blow each article.
>>> I guess I need to add correct logic in article_list.html.
>>>
>>> Please find pics too.
>>>
>>> Sorry, any advice would be really appreciated.
>>>
>>> Best regards,
>>>
>>> Nori
>>>
>>>
>>> On Sunday, April 28, 2019 at 6:06:37 PM UTC-4, Atsunori Kaneshige wrote:

 Hi, Britto,

 Wow, it's working as expected!
 Thank you so much. (*So sorry, one more question below, please find 
 it!*)

 Basically, you added blank=True for author field and article field in 
 Comment model.
 In this way, I don't need to set author/article field in 
 CommentCreateView.

 Instead, we have post function to pass around args and kwargs such as 
 pk.
 You created form.py and author and article fields will be automatically 
 selected via post function.
 I checked admin site and comments I made were successfully saved in 
 database now!

 New views.py
 
 class ArticleCommentCreateView(LoginRequiredMixin, CreateView):
 model = Comment
 template_name = 'article_comment_new.html'
 fields = ('comment',)
 # I don't need 'article' field here, because I set blank=True in 
 Comment model
 login_url = 'login'
 success_url = "/"

 def post(self, request, *args, **kwargs):
 pk = kwargs['pk']
 form = CommentForm(request.POST, pk)
 if form.is_valid():
 new_comment = form.save(commit=False)
 new_comment.author = request.user
 new_comment.article = Article.objects.get(id=pk)
 new_comment.save()
 return HttpResponseRedirect('/')

 **
 By the way, one last thing I wanted to do on top of what we did here is 
 that I wanted to display all comments associated with each article.
 I have been trying to take data from Comment database, but I am not 
 successful about it.

 I am able to take out article data by using *object_list.*
 *But I cannot do the same thing for comments.*

 I still set related_name='comment' in Comment model.
 With this related_name, *{% for comment in article.comments %} *worked 
 in previous program.
 But now, I cannot take out comment data from database.

 Sorry many questions and stealing your time.
 I really appreciate your advice.

 P.S.
 I run shell in my terminal by typing python manage.py shell.
 I did from article.models import Comment
 and I did Comment.objects.all(), then I got all comments printed in my 
 terminal.
 I read somewhere in Django docs, saying that I can implement this kind 
 of query in django program.
 But I also read that this is not best practice in Django if I remember 
 correctly.

 Sorry, I am looking forward to any advice to take out Comment data and 
 display them in the template.

 Best regards,

 Nori

 Here is article_list.html
 {% extends 'base.html' %}

 {% block title %}Articles{% endblock title %}

 {% block content %}
  * {% for article in object_list %}*
 
   
 {{ article.title }} 
 
 by {{ article.author }} |
 {{ article.date }}
   
   
 {{ article.body }}
 Edit
 Delete
   

   
* {% for comment in article.comments %} # this one doesn't work 
 now.*
   
 {{ comment.author }} 
 
 {{ comment }}
   
 {% endfor %}
   
 
 
   {% endfor %}
 {% endblock content %}



What should i do to build a django app on any linux distro which one can use by one-click install

2019-04-29 Thread Meow
It seems appimage can do these, but i don’t know how to do it. Is there anyone 
can help me or give me some advices?
Thank you.

-- 
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/88838990-4f50-4c57-90d6-7c9153406c70%40Spark.
For more options, visit https://groups.google.com/d/optout.


Re: Autoreloader looping Django 2.2

2019-04-29 Thread Ramiro Morales
Hi Dan,

On Fri, Apr 26, 2019 at 11:00 AM Dan  wrote:

> Forgot to mention that this is on a mac osx host with ubuntu 16 virtualbox
> guest, I'm not sure that has something to do with it?
>
> On Thursday, April 25, 2019 at 10:06:59 PM UTC+2, Dan wrote:
>>
>> I'm using Django 2.2 on a new project and suddenly the autoreloader is
>> looping when I change a file
>>
>>
>> DEBUG:
>>
>>
>> /urls.py. is_changed: False, is_new: True
>>
>> /urls.py previous mtime: None, current mtime: 1556221457.0
>>
>> /urls.py notified as changed. Signal results: [(> translation_file_changed at 0x7fd933e05d90>, None)].
>>
>> /urls.py changed, reloading
>>
>> It says the file is new but it was just changed - it refers
>> to translation_file_changed but I have no translation files in my project.
>>
>>
>> My project is on a virtualbox shared folder, if I start a new project
>> from scratch it works ok and previous versions of Django work fine.
>>
>>
>> I tried using watchman + pywatchman and it doesn't seem to work at all, I
>> dont think it works with shared virtualbox folders.
>>
>>
>> Is there anyway I can get this working with 2.2 can I use the old
>> reloader or do I need to revert to 2.1?
>>
>
>
Can you try the stable/2.2.x git branch? it contains a couple of post-2.1
fixes to the reloading code which will get released as 2.2.1 in a few days
AFAIK..

Also, is the folder  where urls-py is located shared between the host and
the VM in some way? What file system type is the host using?

-- 
Ramiro Morales
@ramiromorales

-- 
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/CAO7PdF-i_q_utWwRZmv9Ab9rWGLZRtaqW-woZb%3DfP68DSoF%3DAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help, I need to convert my python code into Secure API using Django

2019-04-29 Thread Vamsi
Hi Chetan,
Thank you very much. I’ll go through these resources and let you know how it 
went.

Sent from my iPhone

> On Apr 29, 2019, at 2:58 PM, Chetan Ganji  wrote:
> 
> Linux is very easy to get started, as a web developer, all the code that you 
> write will end up on a linux server eventually. 
> It would be very good idea to start learning linux immediately. You will 
> require that skill in the near future. 
> None would want to pay the price of windows server when Linux is FREE ;-) 
> 
> However, for the time being, please dabble with apache + modwsgi for windows. 
> I dont remember exact resources I used to deploy on window.
> Simplest alternative is given below.
> https://bitnami.com/stack/django/installer
> 
> One thing I remember is modwsgi is dependant on the python version i.e. 
> different python versions require modwsgi to be built for that specific 
> version.
> Try some the ones listed in below link, if they don't work, you have to 
> search online for that.
> https://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi
> 
> Some tuts from youtube. I havent checked them yet so do your R Follow the 
> steps that they have shown i the video to see if it works.
> https://www.youtube.com/watch?v=s0RX_YU9eJM 
> https://www.youtube.com/watch?v=VnR5O4IjmOs
> 
> Hope it helps. 
> 
> 
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji.che...@gmail.com
> http://ryucoder.in
> 
> 
>> On Tue, Apr 30, 2019 at 12:05 AM Vamsi  
>> wrote:
>> Hi Chetan,
>> Thanks for the quick reply. Linux is not an option for me as I am not well 
>> versed in it. Is it possible for you to give me some resource for windows.
>> 
>> Thanks and regards,
>> Vamsi
>> 
>> Sent from my iPhone
>> 
>>> On Apr 29, 2019, at 1:06 PM, Chetan Ganji  wrote:
>>> 
>>> Hi Vamsi,
>>> 
>>> For No 1 - You can create a REST API using django or (django + django rest 
>>> framework). 
>>> For No 2,3,4 - For production you have to user Apache + modwsgi or nginx + 
>>> gunicorn (or other wsgi compliant server for python). 
>>> 
>>> I dont suggest windows for production. If you plan to use it on linux, 
>>> below is the tutorial. I have used it many times for deployments.
>>> https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04
>>>  
>>> 
>>> 
>>> 
>>> Regards,
>>> Chetan Ganji
>>> +91-900-483-4183
>>> ganji.che...@gmail.com
>>> http://ryucoder.in
>>> 
>>> 
 On Mon, Apr 29, 2019 at 9:46 PM Vamsi tangutoori 
  wrote:
 Hi Everyone,
 I am new to django and python programming. I developed a facial 
 recognition module in python using boto3 library. Currently I sued flask 
 to create an API and test in my development environment but to move it to 
 production i need to use django. Can you please help or point me in the 
 right direction as to how do i do the below.
 
 1. Take my facialrecognition.py file and convert it into an API, 
 preferably using django.
 2. Make this API to be pointing to a specific URL(locally on a windows 
 machine).
 3. Deploy this code into a production machine(windows).
 4. Make sure that the API starts every time the windows machine starts to 
 avoid loosing service.
 
 Things i researched so far are:
 1. How to create a django project with its REST library.
 2. From the articles and tutorials i found out that this is only 
 development version, to deploy in production i need a production server 
 like Apache etc. is this necessary?
 
 Thanks in Advance for your help.
 Vamsi.
 
 -- 
 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/17aa8268-0fd8-4095-a5bb-82e68eecf186%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/CAMKMUjvsqqRLp-6btfhV951gqwq5t1AehKsCgsER2UFuFfhMbA%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 

Re: Help, I need to convert my python code into Secure API using Django

2019-04-29 Thread Chetan Ganji
Linux is very easy to get started, as a web developer, all the code that
you write will end up on a linux server eventually.
It would be very good idea to start learning linux immediately. You will
require that skill in the near future.
None would want to pay the price of windows server when Linux is FREE ;-)

However, for the time being, please dabble with apache + modwsgi for
windows. I dont remember exact resources I used to deploy on window.
Simplest alternative is given below.
https://bitnami.com/stack/django/installer

One thing I remember is modwsgi is dependant on the python version i.e.
different python versions require modwsgi to be built for that specific
version.
Try some the ones listed in below link, if they don't work, you have to
search online for that.
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi

Some tuts from youtube. I havent checked them yet so do your R Follow
the steps that they have shown i the video to see if it works.
https://www.youtube.com/watch?v=s0RX_YU9eJM
https://www.youtube.com/watch?v=VnR5O4IjmOs

Hope it helps.


Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in


On Tue, Apr 30, 2019 at 12:05 AM Vamsi 
wrote:

> Hi Chetan,
> Thanks for the quick reply. Linux is not an option for me as I am not well
> versed in it. Is it possible for you to give me some resource for windows.
>
> Thanks and regards,
> Vamsi
>
> Sent from my iPhone
>
> On Apr 29, 2019, at 1:06 PM, Chetan Ganji  wrote:
>
> Hi Vamsi,
>
> For No 1 - You can create a REST API using django or (django + django rest
> framework).
> For No 2,3,4 - For production you have to user Apache + modwsgi or nginx +
> gunicorn (or other wsgi compliant server for python).
>
> I dont suggest windows for production. If you plan to use it on linux,
> below is the tutorial. I have used it many times for deployments.
>
> https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04
>
>
>
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji.che...@gmail.com
> http://ryucoder.in
>
>
> On Mon, Apr 29, 2019 at 9:46 PM Vamsi tangutoori <
> vamsidhar.tanguto...@gmail.com> wrote:
>
>> Hi Everyone,
>> I am new to django and python programming. I developed a facial
>> recognition module in python using boto3 library. Currently I sued flask to
>> create an API and test in my development environment but to move it to
>> production i need to use django. Can you please help or point me in the
>> right direction as to how do i do the below.
>>
>> 1. Take my facialrecognition.py file and convert it into an API,
>> preferably using django.
>> 2. Make this API to be pointing to a specific URL(locally on a windows
>> machine).
>> 3. Deploy this code into a production machine(windows).
>> 4. Make sure that the API starts every time the windows machine starts to
>> avoid loosing service.
>>
>> Things i researched so far are:
>> 1. How to create a django project with its REST library.
>> 2. From the articles and tutorials i found out that this is only
>> development version, to deploy in production i need a production server
>> like Apache etc. is this necessary?
>>
>> Thanks in Advance for your help.
>> Vamsi.
>>
>> --
>> 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/17aa8268-0fd8-4095-a5bb-82e68eecf186%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/CAMKMUjvsqqRLp-6btfhV951gqwq5t1AehKsCgsER2UFuFfhMbA%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 

Re: Help, I need to convert my python code into Secure API using Django

2019-04-29 Thread Vamsi
Hi Chetan,
Thanks for the quick reply. Linux is not an option for me as I am not well 
versed in it. Is it possible for you to give me some resource for windows.

Thanks and regards,
Vamsi

Sent from my iPhone

> On Apr 29, 2019, at 1:06 PM, Chetan Ganji  wrote:
> 
> Hi Vamsi,
> 
> For No 1 - You can create a REST API using django or (django + django rest 
> framework). 
> For No 2,3,4 - For production you have to user Apache + modwsgi or nginx + 
> gunicorn (or other wsgi compliant server for python). 
> 
> I dont suggest windows for production. If you plan to use it on linux, below 
> is the tutorial. I have used it many times for deployments.
> https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04
>  
> 
> 
> 
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji.che...@gmail.com
> http://ryucoder.in
> 
> 
>> On Mon, Apr 29, 2019 at 9:46 PM Vamsi tangutoori 
>>  wrote:
>> Hi Everyone,
>> I am new to django and python programming. I developed a facial recognition 
>> module in python using boto3 library. Currently I sued flask to create an 
>> API and test in my development environment but to move it to production i 
>> need to use django. Can you please help or point me in the right direction 
>> as to how do i do the below.
>> 
>> 1. Take my facialrecognition.py file and convert it into an API, preferably 
>> using django.
>> 2. Make this API to be pointing to a specific URL(locally on a windows 
>> machine).
>> 3. Deploy this code into a production machine(windows).
>> 4. Make sure that the API starts every time the windows machine starts to 
>> avoid loosing service.
>> 
>> Things i researched so far are:
>> 1. How to create a django project with its REST library.
>> 2. From the articles and tutorials i found out that this is only development 
>> version, to deploy in production i need a production server like Apache etc. 
>> is this necessary?
>> 
>> Thanks in Advance for your help.
>> Vamsi.
>> 
>> -- 
>> 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/17aa8268-0fd8-4095-a5bb-82e68eecf186%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/CAMKMUjvsqqRLp-6btfhV951gqwq5t1AehKsCgsER2UFuFfhMbA%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/A674A3E5-E0DB-45A2-BA90-8B1C7D6CD71D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Displaying Random data on Template

2019-04-29 Thread Cesar Mojarro
Have you sampled your code in a python ide environment to see if your code
works?



On Monday, April 29, 2019, Mayur Bagul  wrote:

> Hello Community,
>
> I'm facing one issue that is i have 3 variables each of which consisting
> list of values.
> what i was trying to do is that i have 3 variables from every variable
> which have  list of value i should get any random value and print it to
> Template web page.
> but it doesn't printing anything of it as well it is not giving any error
> for what i did.
>
> i'm looking forward to get help on how i can display on single value from
> each variable on output.
> I have attached code of template and view.py to this mail.
>
> Thanking you for your 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/ms
> gid/django-users/b3e3ca0b-2003-46f8-8672-eca33e17f698%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/CAHXGZto-%2Bg2Xx-ERAzbqOcRTL8rS5XmdnJkVG1WXmZrofoB53w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: More controls on createsuperuser

2019-04-29 Thread nimbiotics
Anyone capable of running the createsuperuser command on your project most 
probably has access to all and any of the project's files, specially your 
config file.

Actually this user is either a valid su or you are in serious trouble 
because the security of your server sucks or you gave access to your 
project to the wrong person.

So, no I don't think there is any point in doing so. Not because it can't 
be done but because it is both trivially useless.and uselessly trivial.



On Sunday, April 28, 2019 at 11:24:57 PM UTC-4, JJ Zolper wrote:
>
> All,
>
> Curious what people think about more thought and control going into who 
> can run the createsuperuser method?
>
> For example say there's models that I don't want anyone to touch except 
> myself as a superuser. Is it not plausible that even if I make a Django 
> Group around that model that someone could still run createsuperuser and 
> give themselves the ability to have full control?
>
> Wouldn't it make sense if some random developer were to run 
> createsuperuser using django settings with any of the databases (as an 
> example) that it prevent them if say that email isn't on say an internal 
> list in the django admin of approved potential users?
>
> I see something like this being a good idea to prevent just anyone from 
> getting full control over the site without it being specifically provided.
>
> Maybe there's something I'm missing something but been reading about third 
> party options and more about what's there and I just feel there's a hole 
> when it comes to who can create a super user account. Obviously you could 
> have a script that you run to initialize who is a super user, what the 
> groups are etc, but then you're basically recording personal information 
> somewhere when that should only be typed in.
>
> Open to ideas and thoughts, mostly just curious what could be a good 
> answer.
>
> Best,
>
> JJ
>

-- 
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/f85e2d9b-ec2d-4814-b4d5-df137bf8a883%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: help

2019-04-29 Thread Daniel Roseman
On Monday, 29 April 2019 17:45:48 UTC+1, Tosin Ayoola wrote:
>
> hello Nick,
> so is there a way i can get pass this, cause i really need to get a link 
> to show the list of the most read information,
>
>>
>>
Nick told you exactly what to do. assignment_tag has been replaced by 
simple_tag.
-- 
DR. 

-- 
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/05e02f56-16c8-4086-8645-db3475c55603%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Button Event

2019-04-29 Thread Ahmed Ishtiaque
Hi Mayur,

I'm not sure what you mean by "there is no javascript in django" because I
use it all the time. JS is not tied to Django in any way since its
operations are usually client-side and so it can be used inside your Django
templates.

In any case, you can have JS code in your template inside 

Re: Help, I need to convert my python code into Secure API using Django

2019-04-29 Thread Chetan Ganji
Hi Vamsi,

For No 1 - You can create a REST API using django or (django + django rest
framework).
For No 2,3,4 - For production you have to user Apache + modwsgi or nginx +
gunicorn (or other wsgi compliant server for python).

I dont suggest windows for production. If you plan to use it on linux,
below is the tutorial. I have used it many times for deployments.
https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04




Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in


On Mon, Apr 29, 2019 at 9:46 PM Vamsi tangutoori <
vamsidhar.tanguto...@gmail.com> wrote:

> Hi Everyone,
> I am new to django and python programming. I developed a facial
> recognition module in python using boto3 library. Currently I sued flask to
> create an API and test in my development environment but to move it to
> production i need to use django. Can you please help or point me in the
> right direction as to how do i do the below.
>
> 1. Take my facialrecognition.py file and convert it into an API,
> preferably using django.
> 2. Make this API to be pointing to a specific URL(locally on a windows
> machine).
> 3. Deploy this code into a production machine(windows).
> 4. Make sure that the API starts every time the windows machine starts to
> avoid loosing service.
>
> Things i researched so far are:
> 1. How to create a django project with its REST library.
> 2. From the articles and tutorials i found out that this is only
> development version, to deploy in production i need a production server
> like Apache etc. is this necessary?
>
> Thanks in Advance for your help.
> Vamsi.
>
> --
> 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/17aa8268-0fd8-4095-a5bb-82e68eecf186%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/CAMKMUjvsqqRLp-6btfhV951gqwq5t1AehKsCgsER2UFuFfhMbA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Button Event

2019-04-29 Thread Mayur Bagul
Hello Community,

Im looking for solution on Button Event.
I have situation like mention below :

i have one button check temperature. after clicking on it; it should 
display dummy temperature on template from view.py i wrote.  
but im not getting how i can do this because there is no javascript used in 
django.

Please guide me to get rid of this impedance.

Thanking you,
Mayur Bagul. 

-- 
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/3a9d8006-ab98-44e4-a2ce-66e4a439cd9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: help

2019-04-29 Thread Tosin Ayoola
hello Nick,
so is there a way i can get pass this, cause i really need to get a link to
show the list of the most read information,

On Mon, Apr 29, 2019 at 4:10 PM Nick Sarbicki 
wrote:

> Hi Tosin,
>
> The assignment tag was deprecated in 1.9 and removed in 2.0.
>
> The details for this are here:
> https://docs.djangoproject.com/en/2.0/releases/1.9/#assignment-tag
>
> Basically it has been replaced with simple_tag. You should read the docs
> for that here:
> https://docs.djangoproject.com/en/2.2/howto/custom-template-tags/#simple-tags
>
>
> - Nick
>
>
> On Mon, Apr 29, 2019 at 3:14 PM Tosin Ayoola 
> wrote:
>
>> sup guys, i'm kinda lost and need help, i'm working on an electronic
>> noticeboard and course ware web app using django and i'm trying to have a
>> section on the notice board to show the listed of the most read news, using
>> the assignment tag, but with django ver 2.2 it seems not to be available,
>> can anyone help out
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAHLKn70Fo8pqWoq5SBVKohnscDHdoZmaVkSZxbXSCKWfELsJ4Q%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/CAGuvt904dLpe0AYHTro%2BaX3JvzmSyhYXDhbus8UA3Aa5W3Hwxg%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/CAHLKn72HjL%2B3gY%2BjY1nMfs4aV5czL79Dq5eO9bbn3kr0ZKf8dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: help

2019-04-29 Thread Tosin Ayoola
i want to creat an assignment template tag to allow me create a link on a
project i am working on but rite now it seems i can't use the django
assignment template tags, but now the tag has been removed in django
version > 2 is there a way i can do it.

On Mon, Apr 29, 2019 at 4:08 PM Britto .  wrote:

> Cannot understand your problem. Please describe it clearly or share the
> code zipped.
>
>
> Regards
> Britto
>
>
> On Mon, 29 Apr 2019 at 19:44, Tosin Ayoola  wrote:
>
>> sup guys, i'm kinda lost and need help, i'm working on an electronic
>> noticeboard and course ware web app using django and i'm trying to have a
>> section on the notice board to show the listed of the most read news, using
>> the assignment tag, but with django ver 2.2 it seems not to be available,
>> can anyone help out
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAHLKn70Fo8pqWoq5SBVKohnscDHdoZmaVkSZxbXSCKWfELsJ4Q%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/CAF0v3b5cRGt3UMTU1jGm%3DFtVgOAK39%2BffuSijczysV7z4hadoQ%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/CAHLKn738WzKg_N-TK%3DbVBqcwtN%2BAXRwiCRuOHhR8D5mut240Lg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Help, I need to convert my python code into Secure API using Django

2019-04-29 Thread Vamsi tangutoori
Hi Everyone,
I am new to django and python programming. I developed a facial recognition 
module in python using boto3 library. Currently I sued flask to create an 
API and test in my development environment but to move it to production i 
need to use django. Can you please help or point me in the right direction 
as to how do i do the below.

1. Take my facialrecognition.py file and convert it into an API, preferably 
using django.
2. Make this API to be pointing to a specific URL(locally on a windows 
machine).
3. Deploy this code into a production machine(windows).
4. Make sure that the API starts every time the windows machine starts to 
avoid loosing service.

Things i researched so far are:
1. How to create a django project with its REST library.
2. From the articles and tutorials i found out that this is only 
development version, to deploy in production i need a production server 
like Apache etc. is this necessary?

Thanks in Advance for your help.
Vamsi.

-- 
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/17aa8268-0fd8-4095-a5bb-82e68eecf186%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django with Docker

2019-04-29 Thread Nick Sarbicki
Hi Omer,

Docker actually has docs on this itself:
https://docs.docker.com/compose/django/

- Nick


On Mon, Apr 29, 2019 at 4:19 PM Omer Ozsakarya 
wrote:

> Hello all,
>
> How are you deploying your Django applications with Docker?
> 1- Which packages, libraries are you writing into docker compose file?
> 2- Are you also using a virtual environment with docker?
>
> 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/CACGWYAFpn4XxxGjvAKkKsPi_YjYYzdzY17zrs1%3DfGKCAKMm1fA%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/CAGuvt93J5MbJqxjP6%3DfWn%3DRU_%3D0OyCu6vNFQdLNta4ZuDnAQnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to create the django_migrations table (ORA-00907: missing right parenthesis)

2019-04-29 Thread tossouwisdom
Bonjour tout le monde et merci pour vous différents retours. J'ai donc pris 
une la version 1.11 de django et 6.4.1 de cx_Oracle car ne pouvant pas 
utiliser la version 12 d'Oracle. Je travaille sur une base qui est utilisée 
en prod. Ensuite après avoir lancé la commande migrate je me suis confronté 
à un autre problème : 
  File "C:\Python37-32\lib\site-packages\django\contrib\admin\options.py", 
line 12, in 
from django.contrib.admin import helpers, widgets
  File "C:\Python37-32\lib\site-packages\django\contrib\admin\widgets.py", 
line 151
'%s=%s' % (k, v) for k, v in params.items()

*Pour résoudre ce dernier j'ai enlevé une virgule à la fin de l'instruction 
dans le fichier widgets.py ligne 152 
(https://code.djangoproject.com/ticket/29565 
)*
Ensuite j'ai encore eu un autre problème : 
  File 
"C:\Python37-32\lib\site-packages\django\db\backends\oracle\base.py", line 
404, in __init__
self.cursor.numbersAsStrings = True
AttributeError: 'cx_Oracle.Cursor' object has no attribute 
'numbersAsStrings'

*Pour résoudre ce problème j'ai mis en commentaire l’instruction 
"self.cursor.numbersAsStrings = True" à la ligne 404 du fichier "base.py" 
et les tables ont été créées. Grand Merci encore une fois.*

*  Applying contenttypes.0001_initial... OK*
*  Applying auth.0001_initial... OK*
*  Applying admin.0001_initial... OK*
*  Applying admin.0002_logentry_remove_auto_add... OK*
*  Applying contenttypes.0002_remove_content_type_name... OK*
*  Applying auth.0002_alter_permission_name_max_length... OK*
*  Applying auth.0003_alter_user_email_max_length... OK*
*  Applying auth.0004_alter_user_username_opts... OK*
*  Applying auth.0005_alter_user_last_login_null... OK*
*  Applying auth.0006_require_contenttypes_0002... OK*
*  Applying auth.0007_alter_validators_add_error_messages... OK*
*  Applying auth.0008_alter_user_username_max_length... OK*
*  Applying sessions.0001_initial... OK*

Le samedi 27 avril 2019 19:56:34 UTC, tossouwisdom a écrit :
>
> Django 2.2.2
> Cx_oracle 7.2
> base Oracle 11g
>
> When I run the django migrate commande, i have error 
> django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the 
> django_migrations table (ORA-00907: missing right parenthesis)
>
>   Operations to perform:
>   Apply all migrations: admin, auth, contenttypes, sessions
> Running migrations:
> Traceback (most recent call last):
>   File "C:\Python37-32\lib\site-packages\django\db\backends\utils.py", line 
> 82, in _execute
> return self.cursor.execute(sql)
>   File "C:\Python37-32\lib\site-packages\django\db\backends\oracle\base.py", 
> line 510, in execute
> return self.cursor.execute(query, self._param_generator(params))
> cx_Oracle.DatabaseError: ORA-00907: missing right parenthesis
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
>   File "C:\Python37-32\lib\site-packages\django\db\migrations\recorder.py", 
> line 67, in ensure_schema
> editor.create_model(self.Migration)
>   File "C:\Python37-32\lib\site-packages\django\db\backends\base\schema.py", 
> line 307, in create_model
> self.execute(sql, params or None)
>   File "C:\Python37-32\lib\site-packages\django\db\backends\base\schema.py", 
> line 137, in execute
> cursor.execute(sql, params)
>   File "C:\Python37-32\lib\site-packages\django\db\backends\utils.py", line 
> 99, in execute
> return super().execute(sql, params)
>   File "C:\Python37-32\lib\site-packages\django\db\backends\utils.py", line 
> 67, in execute
> return self._execute_with_wrappers(sql, params, many=False, 
> executor=self._execute)
>   File "C:\Python37-32\lib\site-packages\django\db\backends\utils.py", line 
> 76, in _execute_with_wrappers
> return executor(sql, params, many, context)
>   File "C:\Python37-32\lib\site-packages\django\db\backends\utils.py", line 
> 84, in _execute
> return self.cursor.execute(sql, params)
>   File "C:\Python37-32\lib\site-packages\django\db\utils.py", line 89, in 
> __exit__
> raise dj_exc_value.with_traceback(traceback) from exc_value
>   File "C:\Python37-32\lib\site-packages\django\db\backends\utils.py", line 
> 82, in _execute
> return self.cursor.execute(sql)
>   File "C:\Python37-32\lib\site-packages\django\db\backends\oracle\base.py", 
> line 510, in execute
> return self.cursor.execute(query, self._param_generator(params))
> django.db.utils.DatabaseError: ORA-00907: missing right parenthesis
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "manage.py", line 21, in 
> main()
>   File "manage.py", line 17, in main
> execute_from_command_line(sys.argv)
>   File "C:\Python37-32\lib\site-packages\django\core\management\__init__.py", 
> line 381, in execute_from_command_line
> utility.execute()
>   File "C:\Python37-32\lib\site-packages\django\core\management\__init__.py", 
> line 375, in 

Django with Docker

2019-04-29 Thread Omer Ozsakarya
Hello all,

How are you deploying your Django applications with Docker?
1- Which packages, libraries are you writing into docker compose file?
2- Are you also using a virtual environment with docker?

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


Re: help

2019-04-29 Thread Nick Sarbicki
Hi Tosin,

The assignment tag was deprecated in 1.9 and removed in 2.0.

The details for this are here:
https://docs.djangoproject.com/en/2.0/releases/1.9/#assignment-tag

Basically it has been replaced with simple_tag. You should read the docs
for that here:
https://docs.djangoproject.com/en/2.2/howto/custom-template-tags/#simple-tags


- Nick


On Mon, Apr 29, 2019 at 3:14 PM Tosin Ayoola  wrote:

> sup guys, i'm kinda lost and need help, i'm working on an electronic
> noticeboard and course ware web app using django and i'm trying to have a
> section on the notice board to show the listed of the most read news, using
> the assignment tag, but with django ver 2.2 it seems not to be available,
> can anyone help out
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHLKn70Fo8pqWoq5SBVKohnscDHdoZmaVkSZxbXSCKWfELsJ4Q%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/CAGuvt904dLpe0AYHTro%2BaX3JvzmSyhYXDhbus8UA3Aa5W3Hwxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: help

2019-04-29 Thread Britto .
Cannot understand your problem. Please describe it clearly or share the
code zipped.


Regards
Britto


On Mon, 29 Apr 2019 at 19:44, Tosin Ayoola  wrote:

> sup guys, i'm kinda lost and need help, i'm working on an electronic
> noticeboard and course ware web app using django and i'm trying to have a
> section on the notice board to show the listed of the most read news, using
> the assignment tag, but with django ver 2.2 it seems not to be available,
> can anyone help out
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHLKn70Fo8pqWoq5SBVKohnscDHdoZmaVkSZxbXSCKWfELsJ4Q%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/CAF0v3b5cRGt3UMTU1jGm%3DFtVgOAK39%2BffuSijczysV7z4hadoQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


help

2019-04-29 Thread Tosin Ayoola
sup guys, i'm kinda lost and need help, i'm working on an electronic
noticeboard and course ware web app using django and i'm trying to have a
section on the notice board to show the listed of the most read news, using
the assignment tag, but with django ver 2.2 it seems not to be available,
can anyone help out

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


Re: about abstract user

2019-04-29 Thread Andréas Kühne
Hi,

This is not a good way of building a Django user.

To your questions:
1. AbstractUser is a class that implements some of the methods / properties
that Django expects on a User model. See here :
https://docs.djangoproject.com/en/2.2/topics/auth/customizing/#substituting-a-custom-user-model
The way this is implemented currently it is more like extending a user
model - which you can read about here:
https://docs.djangoproject.com/en/2.2/topics/auth/customizing/#extending-the-existing-user-model
But if you want to use AbstractUser as a base class, you shouldn't extend
AbstractUser.
2. The AUTH_USER_MODEL is a setting in django that points to the current
user model. Because you can change this via the substituting link above,
you then need to set the correct user model in settings (which is set be
the setting AUTH_USER_MODEL).

I would recommend that you read about the django custom user model for
example here : https://wsvincent.com/django-custom-user-model-tutorial/
Extending the user model can be done for example here:
https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html

However I would go with creating a custom user model (if this is a new
project).

Regards,

Andréas


Den mån 29 apr. 2019 kl 13:04 skrev sagar ninave :

> class User(AbstractUser):
> tweet = models.ManyToManyField(Tweet, blank=True)
> follower = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True)
> pass
> class Tweet(models.Model):
> tweet = models.TextField()
> favourite = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True, 
> related_name='user_favourite')
>
> def __unicode__(self):
> return self.tweet
>
>
> 1) in above user model has passed AbbstractUser so what does it mean
> 2) also in follower field of User model ManyToManyField has 
> setting.AUTH_USER_MODEL what does it mean
>
> --
> 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/4574d8ae-b0eb-4c4d-8f77-90b3be0a54ab%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/CAK4qSCdAry8u1sNSCGzKPGVAUX_vJ_iKjT_Rxo-pLHt8pdiJ2g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


about abstract user

2019-04-29 Thread sagar ninave


class User(AbstractUser):
tweet = models.ManyToManyField(Tweet, blank=True)
follower = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True)
pass
class Tweet(models.Model):
tweet = models.TextField()
favourite = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True, 
related_name='user_favourite')

def __unicode__(self):
return self.tweet


1) in above user model has passed AbbstractUser so what does it mean 
2) also in follower field of User model ManyToManyField has 
setting.AUTH_USER_MODEL what does it mean

-- 
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/4574d8ae-b0eb-4c4d-8f77-90b3be0a54ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Displaying Random data on Template

2019-04-29 Thread Mayur Bagul
Hello Community,

I'm facing one issue that is i have 3 variables each of which consisting 
list of values.
what i was trying to do is that i have 3 variables from every variable 
which have  list of value i should get any random value and print it to 
Template web page.
but it doesn't printing anything of it as well it is not giving any error 
for what i did.

i'm looking forward to get help on how i can display on single value from 
each variable on output.
I have attached code of template and view.py to this mail.

Thanking you for your 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/b3e3ca0b-2003-46f8-8672-eca33e17f698%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: models and forms

2019-04-29 Thread Nelson Varela
What do you have so far. show some code or explain what you have so far

On Monday, April 22, 2019 at 1:40:06 PM UTC+2, Shereyne Casimsiman wrote:
>
> I am current making a project and django is very new to me, I've been 
> following tutorials but it did not answer my concern..
> My project is to build a quiz that will have an audio as the question . I 
> already installed  the django-audiofield and successfully added it into the 
> admin but my problem is that I don't know how to show it in the templates 
> please help me ... I am running out 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/c126f0ba-21c3-4123-9a43-37fd92121bd9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: More controls on createsuperuser

2019-04-29 Thread Sooraj Parakkattil
Sometimes during development usually this particular suggestion might be
unnecessary. This might be useful in the case of production. As in if DEBUG
=True then the creation of the superuser should need approval from the
existing admins.

Regards,

*S P R*


On Mon, Apr 29, 2019 at 9:05 AM JJ Zolper  wrote:

> What if maybe after the command is run once it then is required to check a
> list of approved subsequent admins before allowing creation of an account?
> Some kind of list stored in the admin that is required to be populated
> following the first admin, or maybe 3 admins?
>
> On Sunday, April 28, 2019 at 11:24:57 PM UTC-4, JJ Zolper wrote:
>>
>> All,
>>
>> Curious what people think about more thought and control going into who
>> can run the createsuperuser method?
>>
>> For example say there's models that I don't want anyone to touch except
>> myself as a superuser. Is it not plausible that even if I make a Django
>> Group around that model that someone could still run createsuperuser and
>> give themselves the ability to have full control?
>>
>> Wouldn't it make sense if some random developer were to run
>> createsuperuser using django settings with any of the databases (as an
>> example) that it prevent them if say that email isn't on say an internal
>> list in the django admin of approved potential users?
>>
>> I see something like this being a good idea to prevent just anyone from
>> getting full control over the site without it being specifically provided.
>>
>> Maybe there's something I'm missing something but been reading about
>> third party options and more about what's there and I just feel there's a
>> hole when it comes to who can create a super user account. Obviously you
>> could have a script that you run to initialize who is a super user, what
>> the groups are etc, but then you're basically recording personal
>> information somewhere when that should only be typed in.
>>
>> Open to ideas and thoughts, mostly just curious what could be a good
>> answer.
>>
>> Best,
>>
>> JJ
>>
> --
> 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/d6c2514a-e74f-4946-a1d8-7dbf57937096%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/CAA1gVCfTcqysrBsAHOV-POGmgEFbmH09E6F99gMO0j51oqyaog%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to ask questions on Django

2019-04-29 Thread sachinbg sachin
Am writing backend for Android app how can I send password reset link
through email without using forms

On Sun, Apr 28, 2019, 9:34 PM Larry Martell  http://www.catb.org/~esr/faqs/smart-questions.html
>
>
> On Sun, Apr 28, 2019 at 12:01 PM John Bagiliko <
> john.bagil...@aims-senegal.org> wrote:
>
>> Hi all,
>>
>> I am a passionate Python Developer. I love Django. I have seen most of
>> the questions that are posed here and have tried to help. I usually fail to
>> be able to help for insufficient information. I think questions asked on
>> this group should have much information to help us know where one is coming
>> from, where one wants to go and what problem is stopping one from going
>> where he wants to go. More importantly, let's know your efforts and where
>> you've already looked and didn't succeed so you don't get suggestions about
>> what you've tried already and so on.
>> I like Stack Overflow for their strict rules. Check how I asked a
>> question on Stack Overflow and got answered in less than 30 minutes here
>> .
>> I also have this tutorial which I think can be a general solution to most
>> of of the questions asked here about forms, queries, CRUD activities etc.
>> See it here
>> 
>>
>>
>> Best,
>> John
>>
>>
>> --
>> *Regards*
>>
>> *JOHN BAGILIKO*
>> *MSc. Mathematical Sciences (Big Data and Computer Security)*
>> *African Institute for Mathematical Sciences (AIMS) | AIMS Senegal*
>>
>> --
> 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/CACwCsY7Ch%2Bo0r%2Bnkq_0i%3DkVrPFNS69-Teyb3to3tJ0NCf3hW2g%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/CAOs61rwLEboOwX1R2OW3F-7UtE8n4%3Dpk43AEKYAbKGhuQ8QwQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.