Re: WYSIWYG/Rich Text Editor recommendations

2019-04-30 Thread Tim Johnson
* Joel Mathew  [190430 17:29]:
> Currently I'm using quill. It's easy to implement, and has all basic
> features.

  Cool. Thanks for that Joel.

> > I'd like to recreate the same functionality with django. I will need
> > to be able to include embedded images.

-- 
Tim Johnson
http://www.tj49.com

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


Re: Issues with editing Django files?

2019-04-30 Thread Kevin Weinberg
Awesome, thank you very much!

On Sat, Apr 27, 2019 at 4:19 PM André Toscano 
wrote:

> Hi Kevin,
> You shouldn't put your files inside the Program Files directory, it's
> protected by the system. Instead, you should create a directory (my
> suggestion) 'git' in your user's directory.
> Inside this directory you should create the directory that will organize
> your code.
> After that you need to create a virtualenv and installl all Python
> packages required in the virtual environment.
> Most Python IDE (WingIDE, VS Code, PyCharm, Eclipse, etc) supports virtual
> environments.
> On Windows you have different options to install Python (Direct, Anaconda,
> CygWin, etc) and create the virtual, the best would be to use a Linux or
> Unix based system. Consider a virtual machine on VirtualBox with a linux
> distribution.
> Even if you are able to run as admin, you could create security issues.
> Regards
> André
>
> Ps.: Here there is a good reference on how to setup the system to develop
> with Django: https://tutorial.djangogirls.org/en/django_installation/
>
>
>
>
>
> Em ter, 23 de abr de 2019 às 09:13, Outomyelement <
> kweinberg.ba...@gmail.com> escreveu:
>
>> I'm new to Python and am working through the Crash Course for Python book
>> using Windows 10 and the latest version of Python and Django.
>>
>> I am trying to edit the models.py file, but i get a permissions denied:
>>
>>
>> [image: Capture.PNG]
>>
>> I am learning on a company computer, i'm wondering if my user permissions
>> are an issue? Given i'm not an admin for my computer, am I going to have an
>> issue trying to save files in these folders without some admin access? I am
>> able to run the cmd as admin?
>>
>> Thank you,
>>
>> Kevin
>>
>> --
>> 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/97307eae-7819-445d-bc9d-4b350a8fbafe%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/ZZOnhbSWbEQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPrw5MG7f3umJ2ipeSYnG6r8%3DqkDBbMseWaK8dSy%3DnM9PLPbnQ%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/CAFh_u0vPyjaySD4J6MvFyUYdd-JZ2m3UpBNLvuuOEBhQx3n0WA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: WYSIWYG/Rich Text Editor recommendations

2019-04-30 Thread Joel Mathew
Currently I'm using quill. It's easy to implement, and has all basic
features.
Sincerely yours,

 Joel G Mathew



On Wed, 1 May 2019 at 05:47, Tim Johnson  wrote:

> Using python 3.7.2 and django 2.1.5
>
> Production is in Ubuntu 16.04 and prospective deployment is likely
> to be CentOS with same python/django.
>
> I'm a retired python developer.
>
> I'd welcome recommendations and/or caveats regarding  a stable
> WYSIWIG "plugin".
>
> Much is available on google, but it is always edifying to hear
> individual comments.
>
> I currently publish on drupal using its ckeditor plugin. My common
> method is to compose articles in LibreOffice, then copy and paste
> into the editor. Works well, except that it IS drupal.
>
> I'd like to recreate the same functionality with django. I will need
> to be able to include embedded images.
>
> TIA
> --
> Tim
> http://www.tj49.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/20190501001716.GD2404%40mail.akwebsoft.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/CAA%3Diw_9GFDrj4DT%3DrZg8UMZeXLj7iG%2Bcz8moe_RNZNfNHkTE%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Troubling installing Python 3 on my iMac

2019-04-30 Thread Alfredo Sumague
the safest way to use the latest python version (python 3.7.3 is the
latest) is to create a virtual environment for python3, from there you
install the latest python version, or you can use brew command  to install
python3. You can also install anaconda on your mac.

Good luck.

On Tue, Apr 30, 2019 at 5:40 AM James  wrote:

> I downloaded the file from the python website and went through the entire
> installation process... accepting all of the default values.  However, when
> I went to my Terminal window and typed python, it still shows the older
> version:
>
> Python 2.7.10 (default, Feb 22 2019, 21:17:52)
>
> [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
>
> What did I do wrong?  I need to get this all setup before I can start the
> Django tutorial.
>
> 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/d4a9335d-5067-4620-882e-e10a6d04dbcd%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/CAGF6mrSbrHFSh53-oFNvr7%2Biddnc2Jv-7T-V7OENiXww1hGvpA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


WYSIWYG/Rich Text Editor recommendations

2019-04-30 Thread Tim Johnson
Using python 3.7.2 and django 2.1.5

Production is in Ubuntu 16.04 and prospective deployment is likely
to be CentOS with same python/django.

I'm a retired python developer.

I'd welcome recommendations and/or caveats regarding  a stable
WYSIWIG "plugin".

Much is available on google, but it is always edifying to hear
individual comments.

I currently publish on drupal using its ckeditor plugin. My common
method is to compose articles in LibreOffice, then copy and paste
into the editor. Works well, except that it IS drupal.

I'd like to recreate the same functionality with django. I will need
to be able to include embedded images.

TIA
-- 
Tim 
http://www.tj49.com

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


Re: Troubling installing Python 3 on my iMac

2019-04-30 Thread RLM

I guess you installed Python3.7.2 or similar

If so you can call it in a terminal with python3 not just python. Open a 
terminal and type python3 it should start

python 7.n is the operating system version.
It is important to use pip3 and  use virtualenv to create the python 3 
environment.


use pip3 to install django in your environment.
When you look at tutorials in google or other specify python3 and >2018 
so you don't get out of date tutorials of which there are hundreds.


Cheers
Roger

On 30/4/19 1:17 pm, James wrote:
I downloaded the file from the python website and went through the 
entire installation process... accepting all of the default values. 
 However, when I went to my Terminal window and typed python, it still 
shows the older version:


Python 2.7.10 (default, Feb 22 2019, 21:17:52)

[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin


What did I do wrong?  I need to get this all setup before I can start 
the Django tutorial.


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/d4a9335d-5067-4620-882e-e10a6d04dbcd%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/1ad8c88c-2268-b5fd-eb10-30f7a9c88b76%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Troubling installing Python 3 on my iMac

2019-04-30 Thread James
Thanks Suresh!  This did the trick.

On Tuesday, April 30, 2019 at 7:36:30 AM UTC-6, Suresh Kannan wrote:
>
> Hi,
>
> Try these steps
>
> https://wsvincent.com/install-python3-mac/
>
> https://stackoverflow.com/a/20868669/4037275 
>
> On Tue, Apr 30, 2019 at 8:39 AM James > 
> wrote:
>
>> I downloaded the file from the python website and went through the entire 
>> installation process... accepting all of the default values.  However, when 
>> I went to my Terminal window and typed python, it still shows the older 
>> version:
>>
>> Python 2.7.10 (default, Feb 22 2019, 21:17:52) 
>>
>> [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
>>
>> What did I do wrong?  I need to get this all setup before I can start the 
>> Django tutorial.
>>
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d4a9335d-5067-4620-882e-e10a6d04dbcd%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/5e0cd72d-a09d-4597-81d8-036a7c3a952c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: error while migrating

2019-04-30 Thread Kasper Laudrup
On April 30, 2019 3:07:05 PM GMT+02:00, RAJA MISHRA 
 wrote:
> django.setup()
>NameError: name 'django' is not defined
>
>-- 
>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/f4654c1c-6ff1-406a-8437-51ff2e1fe7ba%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

class django(object):
def setup(self):
pass

Now django is defined and even has a setup method.

That should solve your issue. If not, consider adding a bit more context to 
your question.

Kind regards,

Kasper Laudrup

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


error while migrating

2019-04-30 Thread RAJA MISHRA
 django.setup()
NameError: name 'django' is not defined

-- 
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/f4654c1c-6ff1-406a-8437-51ff2e1fe7ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Genetic Algorithm for generating timetable

2019-04-30 Thread Britto .
No one knows about genetic algorithm with Django

On Mon, 22 Apr, 2019, 5:09 PM brittocj,  wrote:

> How to implement genetic algorithm in Django to develop a web application
> for timetable generation?
>
> --
> 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/66b48364-c769-4c68-a2a2-29efb77d13a9%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/CAF0v3b5Rog8U08TQrKn3tTk9BjsHR7JU60uwKxT3VpHO6s9unQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Suggested model structure to achieve users selection of services/package

2019-04-30 Thread Gavin Boyle
I am building an application that offers different services, a user can
select and purchase specific needed packages. I want to know the best way
to create the model so that our users can select and once paid it sets the
service to active. I have one model that holds information about each
individual services which includes (Package Title / Description / Price ).
I need another model to handle what services are associated to each user
but I am unsure how to go about this.

I have created two models as shown below but unsure how I can accomplish
the above as I believe there is a better was to accomplish this.

# Model to store club information on what clubs have access to what packages
class ClubPackages(models.Model):

club_id = models.ForeignKey(ClubInfo, on_delete=models.CASCADE)
PACKAGE_STATUS = (
('0', 'Active'),
('1', 'Not Active')
)
player_register_package = models.CharField(default='1',
max_length=1, choices=PACKAGE_STATUS)
player_register_price = models.DecimalField(default=100.00,
max_digits=8, decimal_places=2)
player_register_expiry = models.DateField(default=timezone.now)
roster_package = models.CharField(default='1', max_length=1,
choices=PACKAGE_STATUS)
roster_price = models.DecimalField(default=50.00, max_digits=8,
decimal_places=2)
roster_expiry = models.DateField(default=timezone.now)
rent_a_pitch_package = models.CharField(default='1', max_length=1,
choices=PACKAGE_STATUS)
rent_a_pitch_price = models.DecimalField(default=100.00,
max_digits=8, decimal_places=2)
rent_a_pitch_expiry = models.DateField(default=timezone.now)
shop_package = models.CharField(default='1', max_length=1,
choices=PACKAGE_STATUS)
shop_price = models.DecimalField(default=50.00, max_digits=8,
decimal_places=2)
shop_expiry = models.DateField(default=timezone.now)

# Model to store our available packages
class OurPackages(models.Model):

title = models.CharField(max_length=50)
description = models.TextField(max_length=200)
price = models.DecimalField(max_digits=8, decimal_places=2)

def __str__(self):
return self.title

-- 
__

Séanadh Ríomhphoist/_

Email Disclaimer__
**

Tá an ríomhphost seo agus 
aon chomhad a sheoltar leis faoi rún agus is lena úsáid ag an seolaí agus 
sin amháin é. Is féidir tuilleadh a léamh anseo. 
  
*
_

This e-mail and any 
files transmitted with it are confidential and are intended solely for use 
by the addressee. Read more here. 
 _
*_

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


Re: Simplifying code with multiple loops and logic, into queryset aggregates

2019-04-30 Thread Joel Mathew
Thank you Matthew. Excellent advise as always. When I started off with this
project 5 months ago, I was a beginner to both django and python. I've come
a bit along the journey. That customer model is the first model I created,
and I was unaware of these conventions. By the time I realized that, the
project has branched into several apps, and the code now runs into
thousands of lines of code. I didnt change the naming due to fear of
breaking other code. :)

Nowadays I do it more "pythonically". Still, it's great to have people like
you offer excellent general advise to help budding enthusiasts!

Sincerely yours,

 Joel G Mathew



On Tue, 30 Apr 2019 at 20:33, Matthew Pava  wrote:

> It was a little difficult to follow your message because the formatting is
> non-standard, but I think this might be what you’re looking for.
>
> Also, you should try to follow more Python coding conventions: models
> start with an upper case letter. Variables start with a lower case letter.
>
>
>
> And you probably want to use a QuerySet Manager on Customer. Maybe a query
> like this:
>
> Customer.objects.annotate(is_admitted=Case(When(admission_set__discharged=False,
> then=True), default=False).distinct()
>
>
>
>
>
> *From:* django-users@googlegroups.com [mailto:
> django-users@googlegroups.com] *On Behalf Of *Joel Mathew
> *Sent:* Tuesday, April 30, 2019 9:22 AM
> *To:* django-users@googlegroups.com
> *Subject:* Simplifying code with multiple loops and logic, into queryset
> aggregates
>
>
>
> My models:
>
>
>
> class customer(models.Model):
>
> cstid = models.AutoField(primary_key=True, unique=True)
>
> insurance_number = models.CharField(max_length=100, blank=True,
> null=True)
>
> name = models.CharField(max_length=35)
>
> ageyrs = models.IntegerField(blank=True)
>
>
>
> class Admission(models.Model):
>
> id = models.AutoField(primary_key=True, unique=True)
>
> clinic = models.ForeignKey(Clinic, on_delete=models.CASCADE)
>
> customer = models.ForeignKey(customer, on_delete=models.CASCADE)
>
> diagnosis = models.CharField(max_length=2000, default='', blank=
> True)
>
> date_admission = models.DateTimeField(default=timezone.now)
>
> ward = models.ForeignKey(Ward, on_delete=models.CASCADE)
>
> bed = models.ForeignKey(Bed, on_delete=models.CASCADE)
>
> discharged = models.BooleanField(default=False)
>
> ip_number = models.IntegerField(blank=True)
>
> ip_prefix = models.CharField(max_length=20, default='', blank=True
> )
>
>
>
> My objective: Set a variable to a query filter, adding a property,
> 'is_admitted' to the queryset, so that I can pass this query set to the
> template and use the property while displaying data.
>
>
>
> Code:
>
>
>
> def is_admitted(cust):
>
> admission = Admission.objects.filter(customer=cust, discharged=
> False)
>
> admission_results = len(admission)
>
> if admission_results > 0:
>
> return True
>
> return False
>
>
>
> my_q = or_q_if_truthfull(
>
> cstid=HospitalID,
>
> name__lower__contains=name.lower() if name else None,
>
> ageyrs=ageyrs if ageyrs.isdigit() else None,
>
> agemnths=agemnths if agemnths.isdigit() else None,
>
> mobile__contains=mobile if mobile else None,
>
> alternate__contains=alternate if alternate else None,
>
> email__lower__contains=email.lower() if email else None,
>
> address__lower__contains=address.lower() if address else None,
>
> city__lower__contains=city.lower() if city else None
>
> )
>
> ORSearchResult = customer.objects.filter(my_q, linkedclinic=clinicobj)
>
> cust_set = []
>
> cust_admission_status = []
>
> for cust in ORSearchResult:
>
> cust_set.append(cust)
>
> cust_admission_status.append(is_admitted(cust))
>
> print(f"Customer name: {cust.name} Admission status: {
> is_admitted(cust)}")
>
> cust_templ_set = zip(cust_set, cust_admission_status)
>
>
>
> And in template, I will do:
>
>
>
> {% for cust, status in cust_templ_set %}
>
> {{ cust.name }} {{ status }}
>
> {% endfor %}
>
>
>
> I want to understand how I can convert my above code by generating an
> aggregate over the queryset, so that I can use a property of the query,
> and change the template code to the following, and avoid the loop in the
> view, and the zip. So that the template code becomes:
>
>
>
> {% for cust in customers %}
>
> {{ cust.name }} {{ cust.status }}
>
> {% endfor %}
>
>
>
> I am not sure whether I am making complete sense, and can explain further.
>
> Sincerely yours,
>
>  Joel G Mathew
>
>
>
> --
> 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: More controls on createsuperuser

2019-04-30 Thread Joel Mathew
It's not the command that you should be worried about, but shell access to
your system. If your database server is secure, shell access is restricted,
and the server is also hardened reasonably, you should be relatively safe.
Sincerely yours,

 Joel G Mathew



On Tue, 30 Apr 2019 at 21:07, Mario R. Osorio  wrote:

> You'd only need editing the already existing management command and remove
> the possibility of using createsuperuser, but that is as useless as a
> ceiling fan on a motor bike.as anyone that already has access to the
> management code could just revert those changes. even continuing this
> thread is a waste of time.
>
> Dtb/Gby
> ===
> Mario R. Osorio
> B.A.S. of Information Technology
> Web page: *http;//mario.osorio.solutions
> *
> Email: *mario@osorio.solutions* 
> *Just Choose Python!* 
>
> *SQL programmers don't die, they just ROLLBACK the TRANSACTION.*
>
>
>
> On Tue, Apr 30, 2019 at 11:12 AM Chetan Ganji 
> wrote:
>
>> RE :"*someone could still run createsuperuser *"
>>
>> How do you suppose this is going to happen unless they have access to
>> your system?
>>
>> If you are really concerned about that?? django is basically a package.
>> Just find the source code for the creatsuperuser admin command and delete
>> that file if its the only command in that file ;-)
>> if not just delete that function only :) Its that simple.
>>
>> But How will you create a superuser after deleting the command from the
>> django package??
>>
>> One way to solve is write your own custom management command, create
>> superuser at the time of deployment and delete that custom command also.
>>
>> I hope this solves your problemo :)
>> Cheers!
>>
>>
>> Regards,
>> Chetan Ganji
>> +91-900-483-4183
>> ganji.che...@gmail.com
>> http://ryucoder.in
>>
>>
>> On Tue, Apr 30, 2019 at 6:09 PM Lipika Chandel 
>> wrote:
>>
>>> Hey,
>>> I am using Django 2.2 and I am stuck with the image upload functionality
>>> from admin site. I am not able to get the image on my template.
>>> Please help.
>>>
>>> Thanks & Regards
>>> LIPIKA CHANDEL
>>>
>>> On Tue, Apr 30, 2019 at 11:57 AM Jani Tiainen  wrote:
>>>
 I've have to agree that any attempt to limit superuser creation through
 manage.py is wrong solution to wrong problem.

 Even it's possible to attempt it it is as easy to circumvent.

 So do not give an access to manage.py to users that are not supposed
 to. Problem solved for good.

 ma 29. huhtik. 2019 klo 21.04  kirjoitti:

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

Re: More controls on createsuperuser

2019-04-30 Thread Mario R. Osorio
You'd only need editing the already existing management command and remove
the possibility of using createsuperuser, but that is as useless as a
ceiling fan on a motor bike.as anyone that already has access to the
management code could just revert those changes. even continuing this
thread is a waste of time.

Dtb/Gby
===
Mario R. Osorio
B.A.S. of Information Technology
Web page: *http;//mario.osorio.solutions
*
Email: *mario@osorio.solutions* 
*Just Choose Python!* 

*SQL programmers don't die, they just ROLLBACK the TRANSACTION.*



On Tue, Apr 30, 2019 at 11:12 AM Chetan Ganji 
wrote:

> RE :"*someone could still run createsuperuser *"
>
> How do you suppose this is going to happen unless they have access to your
> system?
>
> If you are really concerned about that?? django is basically a package.
> Just find the source code for the creatsuperuser admin command and delete
> that file if its the only command in that file ;-)
> if not just delete that function only :) Its that simple.
>
> But How will you create a superuser after deleting the command from the
> django package??
>
> One way to solve is write your own custom management command, create
> superuser at the time of deployment and delete that custom command also.
>
> I hope this solves your problemo :)
> Cheers!
>
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji.che...@gmail.com
> http://ryucoder.in
>
>
> On Tue, Apr 30, 2019 at 6:09 PM Lipika Chandel 
> wrote:
>
>> Hey,
>> I am using Django 2.2 and I am stuck with the image upload functionality
>> from admin site. I am not able to get the image on my template.
>> Please help.
>>
>> Thanks & Regards
>> LIPIKA CHANDEL
>>
>> On Tue, Apr 30, 2019 at 11:57 AM Jani Tiainen  wrote:
>>
>>> I've have to agree that any attempt to limit superuser creation through
>>> manage.py is wrong solution to wrong problem.
>>>
>>> Even it's possible to attempt it it is as easy to circumvent.
>>>
>>> So do not give an access to manage.py to users that are not supposed to.
>>> Problem solved for good.
>>>
>>> ma 29. huhtik. 2019 klo 21.04  kirjoitti:
>>>
 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 

Re: More controls on createsuperuser

2019-04-30 Thread Chetan Ganji
RE :"*someone could still run createsuperuser *"

How do you suppose this is going to happen unless they have access to your
system?

If you are really concerned about that?? django is basically a package.
Just find the source code for the creatsuperuser admin command and delete
that file if its the only command in that file ;-)
if not just delete that function only :) Its that simple.

But How will you create a superuser after deleting the command from the
django package??

One way to solve is write your own custom management command, create
superuser at the time of deployment and delete that custom command also.

I hope this solves your problemo :)
Cheers!


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


On Tue, Apr 30, 2019 at 6:09 PM Lipika Chandel 
wrote:

> Hey,
> I am using Django 2.2 and I am stuck with the image upload functionality
> from admin site. I am not able to get the image on my template.
> Please help.
>
> Thanks & Regards
> LIPIKA CHANDEL
>
> On Tue, Apr 30, 2019 at 11:57 AM Jani Tiainen  wrote:
>
>> I've have to agree that any attempt to limit superuser creation through
>> manage.py is wrong solution to wrong problem.
>>
>> Even it's possible to attempt it it is as easy to circumvent.
>>
>> So do not give an access to manage.py to users that are not supposed to.
>> Problem solved for good.
>>
>> ma 29. huhtik. 2019 klo 21.04  kirjoitti:
>>
>>> 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.
>>>
>> --
>> 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/CAHn91oeeEhnsdrWfur0pV-%2B-BGU_mT70fbbmc7qFM1SwB3Df%2Bg%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --

RE: Simplifying code with multiple loops and logic, into queryset aggregates

2019-04-30 Thread Matthew Pava
It was a little difficult to follow your message because the formatting is 
non-standard, but I think this might be what you’re looking for.
Also, you should try to follow more Python coding conventions: models start 
with an upper case letter. Variables start with a lower case letter.

And you probably want to use a QuerySet Manager on Customer. Maybe a query like 
this:
Customer.objects.annotate(is_admitted=Case(When(admission_set__discharged=False,
 then=True), default=False).distinct()


From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Joel Mathew
Sent: Tuesday, April 30, 2019 9:22 AM
To: django-users@googlegroups.com
Subject: Simplifying code with multiple loops and logic, into queryset 
aggregates

My models:

class customer(models.Model):
cstid = models.AutoField(primary_key=True, unique=True)
insurance_number = models.CharField(max_length=100, blank=True, 
null=True)
name = models.CharField(max_length=35)
ageyrs = models.IntegerField(blank=True)

class Admission(models.Model):
id = models.AutoField(primary_key=True, unique=True)
clinic = models.ForeignKey(Clinic, on_delete=models.CASCADE)
customer = models.ForeignKey(customer, on_delete=models.CASCADE)
diagnosis = models.CharField(max_length=2000, default='', blank=True)
date_admission = models.DateTimeField(default=timezone.now)
ward = models.ForeignKey(Ward, on_delete=models.CASCADE)
bed = models.ForeignKey(Bed, on_delete=models.CASCADE)
discharged = models.BooleanField(default=False)
ip_number = models.IntegerField(blank=True)
ip_prefix = models.CharField(max_length=20, default='', blank=True)

My objective: Set a variable to a query filter, adding a property, 
'is_admitted' to the queryset, so that I can pass this query set to the 
template and use the property while displaying data.

Code:

def is_admitted(cust):
admission = Admission.objects.filter(customer=cust, discharged=False)
admission_results = len(admission)
if admission_results > 0:
return True
return False

my_q = or_q_if_truthfull(
cstid=HospitalID,
name__lower__contains=name.lower() if name else None,
ageyrs=ageyrs if ageyrs.isdigit() else None,
agemnths=agemnths if agemnths.isdigit() else None,
mobile__contains=mobile if mobile else None,
alternate__contains=alternate if alternate else None,
email__lower__contains=email.lower() if email else None,
address__lower__contains=address.lower() if address else None,
city__lower__contains=city.lower() if city else None
)
ORSearchResult = customer.objects.filter(my_q, linkedclinic=clinicobj)
cust_set = []
cust_admission_status = []
for cust in ORSearchResult:
cust_set.append(cust)
cust_admission_status.append(is_admitted(cust))
print(f"Customer name: {cust.name} Admission status: 
{is_admitted(cust)}")
cust_templ_set = zip(cust_set, cust_admission_status)

And in template, I will do:

{% for cust, status in cust_templ_set %}
{{ cust.name }} {{ status }}
{% endfor %}

I want to understand how I can convert my above code by generating an aggregate 
over the queryset, so that I can use a property of the query, and change the 
template code to the following, and avoid the loop in the view, and the zip. So 
that the template code becomes:

{% for cust in customers %}
{{ cust.name }} {{ cust.status }}
{% endfor %}

I am not sure whether I am making complete sense, and can explain further.
Sincerely yours,
 Joel G Mathew

--
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/CAA%3Diw_-8OUE5cd%3DZBahkLMTSTD%3DOXJbYenHjiB3ORGfkY9mSrQ%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 

Re: Button Event

2019-04-30 Thread Joel Mathew
Templates expand into html. So you just write javascript like you normally
do. You call javascript from within your templates by using something like:



Here, I am using {% load static %}
Sincerely yours,

 Joel G Mathew



On Tue, 30 Apr 2019 at 12:05, Mayur Bagul  wrote:

> Thanks Ahmed,
>
> can you please provide me resource to learn  how to use java script and
> events in django Templates?
> Because im not getting proper resource how to use java script in django.
>
> Actually on one web page there will be one button after clicking on that
> button i want to merge another web page inside  current one.
> can you help me with that?
>
> Thanking you
>
>
>
>
>
>
> On Monday, April 29, 2019 at 11:03:35 PM UTC+5:30, Ahmed Ishtiaque wrote:
>>
>> 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 

Simplifying code with multiple loops and logic, into queryset aggregates

2019-04-30 Thread Joel Mathew
My models:


class customer(models.Model):
cstid = models.AutoField(primary_key=True, unique=True)
insurance_number = models.CharField(max_length=100, blank=True, null=True)
name = models.CharField(max_length=35)
ageyrs = models.IntegerField(blank=True)

class Admission(models.Model):
id = models.AutoField(primary_key=True, unique=True)
clinic = models.ForeignKey(Clinic, on_delete=models.CASCADE)
customer = models.ForeignKey(customer, on_delete=models.CASCADE)
diagnosis = models.CharField(max_length=2000, default='', blank=True)
date_admission = models.DateTimeField(default=timezone.now)
ward = models.ForeignKey(Ward, on_delete=models.CASCADE)
bed = models.ForeignKey(Bed, on_delete=models.CASCADE)
discharged = models.BooleanField(default=False)
ip_number = models.IntegerField(blank=True)
ip_prefix = models.CharField(max_length=20, default='', blank=True)

My objective: Set a variable to a query filter, adding a property,
'is_admitted' to the queryset, so that I can pass this query set to the
template and use the property while displaying data.

Code:


def is_admitted(cust):
admission = Admission.objects.filter(customer=cust, discharged=False)
admission_results = len(admission)
if admission_results > 0:
return True
return False


my_q = or_q_if_truthfull(
cstid=HospitalID,
name__lower__contains=name.lower() if name else None,
ageyrs=ageyrs if ageyrs.isdigit() else None,
agemnths=agemnths if agemnths.isdigit() else None,
mobile__contains=mobile if mobile else None,
alternate__contains=alternate if alternate else None,
email__lower__contains=email.lower() if email else None,
address__lower__contains=address.lower() if address else None,
city__lower__contains=city.lower() if city else None
)
ORSearchResult = customer.objects.filter(my_q, linkedclinic=clinicobj)
cust_set = []
cust_admission_status = []
for cust in ORSearchResult:
cust_set.append(cust)
cust_admission_status.append(is_admitted(cust))
print(f"Customer name: {cust.name} Admission status: {is_admitted(cust)}")
cust_templ_set = zip(cust_set, cust_admission_status)

And in template, I will do:

{% for cust, status in cust_templ_set %}
{{ cust.name }} {{ status }}
{% endfor %}

I want to understand how I can convert my above code by generating an
aggregate over the queryset, so that I can use a property of the query, and
change the template code to the following, and avoid the loop in the view,
and the zip. So that the template code becomes:

{% for cust in customers %}
{{ cust.name }} {{ cust.status }}
{% endfor %}

I am not sure whether I am making complete sense, and can explain further.
Sincerely yours,

 Joel G Mathew

-- 
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/CAA%3Diw_-8OUE5cd%3DZBahkLMTSTD%3DOXJbYenHjiB3ORGfkY9mSrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Button Event

2019-04-30 Thread Suresh Kannan
Hi,

Have a look at this
https://stackoverflow.com/questions/298772/django-template-variables-and-javascript

There are also several tutorials in youtube as well.

On Mon, Apr 29, 2019 at 1:03 PM Mayur Bagul  wrote:

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

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


Re: Troubling installing Python 3 on my iMac

2019-04-30 Thread Suresh Kannan
Hi,

Try these steps

https://wsvincent.com/install-python3-mac/

https://stackoverflow.com/a/20868669/4037275

On Tue, Apr 30, 2019 at 8:39 AM James  wrote:

> I downloaded the file from the python website and went through the entire
> installation process... accepting all of the default values.  However, when
> I went to my Terminal window and typed python, it still shows the older
> version:
>
> Python 2.7.10 (default, Feb 22 2019, 21:17:52)
>
> [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
>
> What did I do wrong?  I need to get this all setup before I can start the
> Django tutorial.
>
> 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/d4a9335d-5067-4620-882e-e10a6d04dbcd%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/CANfVfcAPccwd4akLmC6YZ0Ehn4DPUT7bgFcPsyZHFZGn%2B8FFGA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: DateTimeField is in UTC but need IST standards

2019-04-30 Thread vineeth sagar
whenever USE_TZ=True is enabled, the timestamp is stored as a UTC object.
This is standard practice, why?

https://docs.djangoproject.com/en/2.2/topics/i18n/timezones/

Go through this, more than once. It'll be helpful.

On Tue, 30 Apr 2019, 18:09 Sampath Reddy, 
wrote:

> Hey guys,
>
> I am using DjangoRestFramework as tech stack to develop backend API points
> for my application.
>
> I have a model with field created = models.DateTimeField(auto_now_add=True)
> in one of the models.
>
> I am using mysql as backend db, now the problem I am having is I am not
> able to figure out how the timestamp is being generated. timestamp is in
> UTC.
>
> But I want to store IST standards i.e TimeZone 'Asia/Kolkata'
>
> I can confirm mysql database time settings and Django TimeZone settings
> are working as expected i.e IST standards.
>
> Kindly someone please help me in figuring how the timestamp is being
> generated wen I am posting data to the table.
>
> Thanks and Regards,
> Sampath
>
>
> --
> 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/CAErixQ1YWANdnf21jOf0yxMcFRX0S1RExs4-%3DOMEY5v6pLNmsw%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/CAMMZq8M7JYBuimPbkvH_ot_yB%3DUw4Gj1w%3DRZXyWFfw3GuYPNMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Troubling installing Python 3 on my iMac

2019-04-30 Thread Aditya Singh
Kindly type python3 in the terminal and let me know the output :)

On Tue, Apr 30, 2019, 6:10 PM James  wrote:

> I downloaded the file from the python website and went through the entire
> installation process... accepting all of the default values.  However, when
> I went to my Terminal window and typed python, it still shows the older
> version:
>
> Python 2.7.10 (default, Feb 22 2019, 21:17:52)
>
> [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
>
> What did I do wrong?  I need to get this all setup before I can start the
> Django tutorial.
>
> 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/d4a9335d-5067-4620-882e-e10a6d04dbcd%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/CAEPfumjm6tEYNCL3mLh5R%2B4%2BtJZ9_t2GtCOr2fybaHbx5310Ew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


DateTimeField is in UTC but need IST standards

2019-04-30 Thread Sampath Reddy
Hey guys,

I am using DjangoRestFramework as tech stack to develop backend API points
for my application.

I have a model with field created = models.DateTimeField(auto_now_add=True)
in one of the models.

I am using mysql as backend db, now the problem I am having is I am not
able to figure out how the timestamp is being generated. timestamp is in
UTC.

But I want to store IST standards i.e TimeZone 'Asia/Kolkata'

I can confirm mysql database time settings and Django TimeZone settings are
working as expected i.e IST standards.

Kindly someone please help me in figuring how the timestamp is being
generated wen I am posting data to the table.

Thanks and Regards,
Sampath

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


Re: More controls on createsuperuser

2019-04-30 Thread Lipika Chandel
Hey,
I am using Django 2.2 and I am stuck with the image upload functionality
from admin site. I am not able to get the image on my template.
Please help.

Thanks & Regards
LIPIKA CHANDEL

On Tue, Apr 30, 2019 at 11:57 AM Jani Tiainen  wrote:

> I've have to agree that any attempt to limit superuser creation through
> manage.py is wrong solution to wrong problem.
>
> Even it's possible to attempt it it is as easy to circumvent.
>
> So do not give an access to manage.py to users that are not supposed to.
> Problem solved for good.
>
> ma 29. huhtik. 2019 klo 21.04  kirjoitti:
>
>> 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.
>>
> --
> 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/CAHn91oeeEhnsdrWfur0pV-%2B-BGU_mT70fbbmc7qFM1SwB3Df%2Bg%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/CAHDaQHGYSkookJsAXDtjgD_FHkvNfJRRQ7peZiJgYJzsKV_QuA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Troubling installing Python 3 on my iMac

2019-04-30 Thread James
I downloaded the file from the python website and went through the entire 
installation process... accepting all of the default values.  However, when 
I went to my Terminal window and typed python, it still shows the older 
version:

Python 2.7.10 (default, Feb 22 2019, 21:17:52) 

[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin

What did I do wrong?  I need to get this all setup before I can start the 
Django tutorial.

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/d4a9335d-5067-4620-882e-e10a6d04dbcd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django with Docker

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

I deploy using the latest version of the 3.7 python docker image. Then we
add all of the requirements into the docker container - without a virtual
environment. Because the docker image will only run the django application,
there is no need for creating a virtual environment. If I need another
application I create another docker image.

Hope this answers your questions.

Regards,

Andréas


Den mån 29 apr. 2019 kl 17:19 skrev 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.
>

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


Accessing single value from multiple values from databse

2019-04-30 Thread Mayur Bagul
Hello community,

i have created three fields in my model Data 

   - Two-wheeler
   - four-wheeler

inside each field i have putted 5 values.

now i wanted to display single random value from these two fields every 
time i click on button. and thats where im getting stuck.
How to do this ?

if any one have resources related to this issue please provide me and help 
me with your solution.



Thanking 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/fdbe7f32-301f-494c-862e-aec7de402397%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Button Event

2019-04-30 Thread Mayur Bagul
Thanks Ahmed,

can you please provide me resource to learn  how to use java script and 
events in django Templates?
Because im not getting proper resource how to use java script in django.

Actually on one web page there will be one button after clicking on that 
button i want to merge another web page inside  current one.
can you help me with that?

Thanking you






On Monday, April 29, 2019 at 11:03:35 PM UTC+5:30, Ahmed Ishtiaque wrote:
>
> 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: More controls on createsuperuser

2019-04-30 Thread Jani Tiainen
I've have to agree that any attempt to limit superuser creation through
manage.py is wrong solution to wrong problem.

Even it's possible to attempt it it is as easy to circumvent.

So do not give an access to manage.py to users that are not supposed to.
Problem solved for good.

ma 29. huhtik. 2019 klo 21.04  kirjoitti:

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

-- 
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/CAHn91oeeEhnsdrWfur0pV-%2B-BGU_mT70fbbmc7qFM1SwB3Df%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.