Re: GeoDjango GIS Model Fieldset Usage

2018-01-10 Thread Jani Tiainen

Hi,

Apparently you have mistaken what GeoDjango is.

GeoDjango is a GIS framework, that is it deals with (usually) real world 
coordinates.


And in most cases coordinates are 3D. Two well known coordinate systems 
are WGS84 (GPS uses this) and second one is Google Transverse Mercator.


GIS is usually used to do spatial lookups, like does two geometries 
intersect, or is point within specific polygon.


In GIS you do have few math ops, mainly distance and area. Distance and 
area math depends a bit of used coordinate system since some coordinate 
systems can take earth curvature in to account.


What you asking is actually is more like trigonometry which GeoDjango 
can't really do.


On 11.1.2018 6.53, Shazia Nusrat wrote:
For Instance...lets say I need to let customer calculate Azimuth for 
the home roof with ModelForm.
Its not a simple one single direction. If you can do it let me know 
with example.


Regards,
Shazia.

On Wed, Jan 10, 2018 at 11:30 PM, Jani Tiainen > wrote:


Hi.

So what is your actual problem?

11.1.2018 3.04 "Shazia Nusrat" mailto:shazianu...@gmail.com>> kirjoitti:

Hi,

I need quick help about using the fields in the following model:

class Size(models.Model):
   azimuth = models.CharField(max_length=200, blank=True,
null=True)
 tilt = models.CharField(max_length=200, blank=True, null=True)
 boundary_coordinates = models.CharField(max_length=200,
blank=True)
 height = models.CharField(max_length=200, blank=True)
 width = models.CharField(max_length=200, blank=True)

I know there is a function reference for it but I don't know
how to use it as per the link below because I am newbie.

https://docs.djangoproject.com/en/2.0/ref/contrib/gis/functions/


Please advise.
-- 
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/CAD83tOz2xe4mHbbd1Xyag-Tad%2B3zsRjtQyTgC1C4Q35V1Wf4gg%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/CAHn91oeB9c1axU-p7hyXZz5tD8sSbAskK7d%3DpVWTUvEsJwNHrA%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/CAD83tOwpUu9xy4Qo4FiFO6OB4_8ocFt6sjuk3dB_tqV_Zm5nhQ%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
Jani Tiainen

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

Re: GeoDjango GIS Model Fieldset Usage

2018-01-10 Thread Shazia Nusrat
For Instance...lets say I need to let customer calculate Azimuth for the
home roof with ModelForm.
Its not a simple one single direction. If you can do it let me know with
example.

Regards,
Shazia.

On Wed, Jan 10, 2018 at 11:30 PM, Jani Tiainen  wrote:

> Hi.
>
> So what is your actual problem?
>
> 11.1.2018 3.04 "Shazia Nusrat"  kirjoitti:
>
>> Hi,
>>
>> I need quick help about using the fields in the following model:
>>
>> class Size(models.Model):
>>azimuth = models.CharField(max_length=200, blank=True, null=True)
>>tilt = models.CharField(max_length=200, blank=True, null=True)
>>boundary_coordinates = models.CharField(max_length=200, blank=True)
>>height = models.CharField(max_length=200, blank=True)
>>width = models.CharField(max_length=200, blank=True)
>>
>> I know there is a function reference for it but I don't know how to use
>> it as per the link below because I am newbie.
>>
>> https://docs.djangoproject.com/en/2.0/ref/contrib/gis/functions/
>>
>> Please advise.
>>
>> --
>> 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/CAD83tOz2xe4mHbbd1Xyag-Tad%2B3zsRjtQyTgC1C4
>> Q35V1Wf4gg%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/CAHn91oeB9c1axU-p7hyXZz5tD8sSbAskK7d%
> 3DpVWTUvEsJwNHrA%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/CAD83tOwpUu9xy4Qo4FiFO6OB4_8ocFt6sjuk3dB_tqV_Zm5nhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: GeoDjango GIS Model Fieldset Usage

2018-01-10 Thread Jani Tiainen
Hi.

So what is your actual problem?

11.1.2018 3.04 "Shazia Nusrat"  kirjoitti:

> Hi,
>
> I need quick help about using the fields in the following model:
>
> class Size(models.Model):
>azimuth = models.CharField(max_length=200, blank=True, null=True)
>tilt = models.CharField(max_length=200, blank=True, null=True)
>boundary_coordinates = models.CharField(max_length=200, blank=True)
>height = models.CharField(max_length=200, blank=True)
>width = models.CharField(max_length=200, blank=True)
>
> I know there is a function reference for it but I don't know how to use it
> as per the link below because I am newbie.
>
> https://docs.djangoproject.com/en/2.0/ref/contrib/gis/functions/
>
> Please advise.
>
> --
> 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/CAD83tOz2xe4mHbbd1Xyag-Tad%2B3zsRjtQyTgC1C4Q35V1Wf4gg%
> 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/CAHn91oeB9c1axU-p7hyXZz5tD8sSbAskK7d%3DpVWTUvEsJwNHrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Are URL namespaces optional or are they used by default by Django?

2018-01-10 Thread Stodge
Problem solved and apparently it was my silly mistake! While experimenting 
I added app_name to my urls files. Apparently this enables namespace 
support. So I removed them from my urls files and it works.

Thanks

On Thursday, 21 December 2017 10:38:36 UTC-5, Stodge wrote:
>
> I am porting an app from Django 1.6.x to 1.10.x and I'm hitting a problem 
> with URL namespaces. I don't specifically configure any namespaces in my 
> URLs but Django seems to think that all my app URLs are namespaced. The 
> documentation seems to imply that namespaces are optional and only 
> configured if provided, but my experience suggests otherwise. Would someone 
> be able to confirm if namespaces are optional (opt-in)? I'm really rather 
> confused at the moment about this. 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/9126cdfd-81e5-48ee-97b9-ad62edaeff4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: HTML video seek problem in django

2018-01-10 Thread Manjunatha
Hi Julio  Biason*,*

I have not added any javascript, I downloaded the video from youtube and 
put it in inside Django folder. In the HTML  tag I gave the path of 
the link. The video is playing but not forward and backward feature. It's 
only in *Chrome* browser.

*Regards,*
*Manjunatha,*


On Wednesday, 10 January 2018 19:00:42 UTC+5:30, Julio Biason wrote:
>
> Hi Manjunatha,
>
> Django just serves the content, it doesn't handle how it will be played. 
> It could be a problem with your player, or some JS error -- in other words, 
> nothing to do with Django itself.
>
> On Wed, Jan 10, 2018 at 8:03 AM, Manjunatha L Naik  > wrote:
>
>> Hii,
>>
>>  
>>
>> When load video from Django app, the video seeking(forward and backward) 
>> is not possible with chrome browser. It works fine with IE and Mozilla 
>> Firefox.. Please help me out.
>>
>>  
>>
>> Thanks,
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/57db425c-e1fc-406d-85df-570a512751a4%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> *Julio Biason*, Sofware Engineer
> *AZION*  |  Deliver. Accelerate. Protect.
> Office: +55 51 3083 8101  |  Mobile: +55 51 *99907 0554*
>

-- 
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/495e0348-c5ee-4cfa-a0f6-4e7dfebcac09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I plan to have lots of data tables with similar structure. How do you recommend I model them?

2018-01-10 Thread Mike Dewhirst

On 11/01/2018 12:20 PM, Tom Tanner wrote:

Hey everyone,

I have a bunch of text files that each have a bunch of columns in 
common. I plan to import these files into PostgreSQL tables. The 
website user will be able to send a GET request to query a table and 
get back data from it. Since most of the tables will have a bunch of 
columns in common, how should I structure them in my `models.py`?


I think you want a core model with most of the common fields and meta 
abstract = True ...


class CoreFields(models.Model):
    ...
    class Meta:
    abstract = True

Then a bunch of other tables set up with fields which are not in 
CoreFields ...


class DataSetX(CoreFields):
    ...

You can also move any methods in common into CoreFields

hth

Mike



Here's a couple examples of tab-delimited text files I'll import.

|
    NAME S1903_C02_001E state county tract State-County-Tract-ID
CensusTract201,AutaugaCounty,Alabama66100102010001001020100
CensusTract202,AutaugaCounty,Alabama411070100102020001001020200
CensusTract203,AutaugaCounty,Alabama512500100102030001001020300

|


and

|
    NAME S1903_C02_001F S1903_C02_001G state county tract 
State-County-Tract-ID

CensusTract201,AutaugaCounty,Alabama6600040400100102010001001020100
CensusTract202,AutaugaCounty,Alabama411071928370100102020001001020200
CensusTract203,AutaugaCounty,Alabama51250394820100102030001001020300
|


As you can see, they have several columns in common. I wouldn't want 
to repeat myself in `models.py` by listing the same columns over and over.

--
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/e5fc9dab-c0aa-4fb8-a66c-5f507a18f4b6%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/9e0bc8ed-59e7-8f58-5698-0fcaaee9b8d9%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


I plan to have lots of data tables with similar structure. How do you recommend I model them?

2018-01-10 Thread Tom Tanner
Hey everyone,

I have a bunch of text files that each have a bunch of columns in common. I 
plan to import these files into PostgreSQL tables. The website user will be 
able to send a GET request to query a table and get back data from it. 
Since most of the tables will have a bunch of columns in common, how should 
I structure them in my `models.py`?

Here's a couple examples of tab-delimited text files I'll import.

NAME S1903_C02_001E state county tract State-County-Tract-ID
Census Tract 201, Autauga County, Alabama 66000 01 001 020100 
01001020100
Census Tract 202, Autauga County, Alabama 41107 01 001 020200 
01001020200
Census Tract 203, Autauga County, Alabama 51250 01 001 020300 
01001020300



and 

NAME S1903_C02_001F S1903_C02_001G state county tract State-County-Tract
-ID
Census Tract 201, Autauga County, Alabama 66000 4040 01 001 020100 
01001020100
Census Tract 202, Autauga County, Alabama 41107 192837 01 001 020200 
01001020200
Census Tract 203, Autauga County, Alabama 51250 39482 01 001 020300 
01001020300


As you can see, they have several columns in common. I wouldn't want to 
repeat myself in `models.py` by listing the same columns over and over.

-- 
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/e5fc9dab-c0aa-4fb8-a66c-5f507a18f4b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do I make a Django model from a tab-delimited data file?

2018-01-10 Thread Tom Tanner
Thanks you two. I'll check out that parser.

On Monday, January 8, 2018 at 9:38:44 PM UTC-5, Tom Tanner wrote:
>
> I have a tab-delimited data file that looks something like this:
>
>
> NAME S1903_C02_001E state county tract State-County-Tract-ID
> Census Tract 201, Autauga County, Alabama 66000 01 001 020100 01001020100
> Census Tract 202, Autauga County, Alabama 41107 01 001 020200 01001020200
> Census Tract 203, Autauga County, Alabama 51250 01 001 020300 01001020300
>
> I want to make a Django model named `MyModel` with three columns: "name", 
> "data", and "geoid", which correspond to the file's columns "NAME", 
> "S1903_C02_001E", and "State-County-Tract-ID." Can I do this via command 
> line, or with a custom Python script? I'm running my Django project locally 
> on a computer running Debian 9.3. 
>

-- 
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/3437a3bc-6a71-4a21-a410-7ede182cb83d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


GeoDjango GIS Model Fieldset Usage

2018-01-10 Thread Shazia Nusrat
Hi,

I need quick help about using the fields in the following model:

class Size(models.Model):
   azimuth = models.CharField(max_length=200, blank=True, null=True)
   tilt = models.CharField(max_length=200, blank=True, null=True)
   boundary_coordinates = models.CharField(max_length=200, blank=True)
   height = models.CharField(max_length=200, blank=True)
   width = models.CharField(max_length=200, blank=True)

I know there is a function reference for it but I don't know how to use it
as per the link below because I am newbie.

https://docs.djangoproject.com/en/2.0/ref/contrib/gis/functions/

Please advise.

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


Re: Admin case-insensitive sorting question

2018-01-10 Thread Mike Dewhirst

On 11/01/2018 10:53 AM, Mike Dewhirst wrote:

On 11/01/2018 1:22 AM, Matthew Pava wrote:
If I'm understanding you correctly, you could use a callable in the 
list_display definition.


That is what I'm doing. Unfortunately a callable for a list_display 
column prevents sorting the list by that column.


I just thought of something. Maybe adjusting the model __str__() 
method to always uppercase the first char of the name will work. I'll 
have to back out all the adjustments so far and give it a try. I'll 
report back.


Didn't work. I have decided to uppercase the first char of every 
substance name on saving. Being able to sort by list columns beats using 
a callable.


Thanks again

Mike



Thanks

Mike

https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display 



def lower_case_name(obj):
 return ("%s" % str(obj).lower()
lower_case_name.short_description = 'Substance'

class SubstanceAdmin(admin.ModelAdmin):
 list_display = (lower_case_name,)

-Original Message-
From: django-users@googlegroups.com 
[mailto:django-users@googlegroups.com] On Behalf Of Mike Dewhirst

Sent: Wednesday, January 10, 2018 1:03 AM
To: Django users
Subject: Admin case-insensitive sorting question

I have tried every which way to produce a case-insenstive list of 
substances in the Admin including this:


def get_queryset(self, request):
      return super(SubstanceAdmin,
self).get_queryset(request).order_by(Lower('name').asc())

Which DOES work (as proven via print statement) but doesn't display 
that way in the Admin which uses the natural ascii order. It is the 
list_display feature which re-orders the substances.


I can get them sorting pseudo-insensitively by using a method to 
uppercase the first char of the name and passing that method to 
list_display.


However, that prevents the column order reversal feature which is a 
function of the list_display feature.


I thought a case insensitive model manager might work until I saw in 
the docs that subsequent order_by filtering will spoil it and I would 
still have to pseudo_name them anyway.


So the question is ... should I bite the bullet and add a sort field 
to the model and fill it with the substance name converted to 
lower-case?


Thanks

Mike

--
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/b1fc1d23-b0ab-d35e-9049-9a4f6091a4f7%40dewhirst.com.au.

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/83a22a09-f6df-6525-02cc-ff26214fad4a%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Admin case-insensitive sorting question

2018-01-10 Thread Mike Dewhirst

On 11/01/2018 1:22 AM, Matthew Pava wrote:

If I'm understanding you correctly, you could use a callable in the 
list_display definition.


That is what I'm doing. Unfortunately a callable for a list_display 
column prevents sorting the list by that column.


I just thought of something. Maybe adjusting the model __str__() method 
to always uppercase the first char of the name will work. I'll have to 
back out all the adjustments so far and give it a try. I'll report back.


Thanks

Mike


https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

def lower_case_name(obj):
 return ("%s" % str(obj).lower()
lower_case_name.short_description = 'Substance'

class SubstanceAdmin(admin.ModelAdmin):
 list_display = (lower_case_name,)

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Mike Dewhirst
Sent: Wednesday, January 10, 2018 1:03 AM
To: Django users
Subject: Admin case-insensitive sorting question

I have tried every which way to produce a case-insenstive list of substances in 
the Admin including this:

def get_queryset(self, request):
      return super(SubstanceAdmin,
self).get_queryset(request).order_by(Lower('name').asc())

Which DOES work (as proven via print statement) but doesn't display that way in 
the Admin which uses the natural ascii order. It is the list_display feature 
which re-orders the substances.

I can get them sorting pseudo-insensitively by using a method to uppercase the 
first char of the name and passing that method to list_display.

However, that prevents the column order reversal feature which is a function of 
the list_display feature.

I thought a case insensitive model manager might work until I saw in the docs 
that subsequent order_by filtering will spoil it and I would still have to 
pseudo_name them anyway.

So the question is ... should I bite the bullet and add a sort field to the 
model and fill it with the substance name converted to lower-case?

Thanks

Mike

--
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/b1fc1d23-b0ab-d35e-9049-9a4f6091a4f7%40dewhirst.com.au.
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/7f368bb3-34b8-cf48-e15b-a80fce2ea670%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Handling secret keys in digitalocean

2018-01-10 Thread Mike Dewhirst
My requirements are to keep sensitive items out of the repositories and 
that means out of settings.


I keep a separate directory structure for settings as recommended in 2 
Scoops. That means the code in my project has to detect which site it is 
running on (local, staging or production) and then load the settings 
file for that site.


Since as it knows whether it is local, staging or production I can 
leverage that to find credentials and other sensitive stuff in files 
stored safely on disk and named for their content in a directory named 
local, staging or production.


I wrote a little python program getcreds.py to go fetch the data as 
required in settings.


Works for me.

Cheers

Mike

#getcreds.py

# -*- coding: utf-8 -*-

# Copyright (C) 2017 Climate Pty Ltd

# This is free software subject to the terms of the GNU GPL v3

"""

getcreds returns secret info which should never be stored in a

repository. For example, username and password etc.

It requires a credsroot directory to already exist and also a project

sub-directory to contain text files holding the required secret

information. Other secret info would be in other project sub-dirs.

When called with project="xyz" and credsroot="/var/www/creds" (the

default), it joins them to discover credsdir in which it looks for

fname which contains the secret info. Otherwise, if you supply the

entire credsdir eg "/var/www/creds/xyz" it will use that instead.

Forward slashes always work on Windows in Python code. Otherwise

use doubled backslashes eg "\\var\\www\\creds\\xyz"

Each line of the named text file (fname) will be read into a list

with the first line in the zero'th element of the list ie creds[0]

In your code requiring credentials or other secret info for example:

from .getcreds import getcreds

...

credslist = getcreds("db.host", project="xyz")

database_host = credslist[0]

database_port = credslist[1]

database_user = credslist[2]

database_pass = credslist[3]

# now establish a database connection

...

Provided you have established appropriate read permissions in credsdir

the secrets are protected. Because they never appear in your code they

stay out of the repository so that many years hence they cannot be

discovered under any nefarious circumstances.

"""

from __future__ import unicode_literals, absolute_import, division

import os

def getcreds(fname, project, credsroot='/var/www/creds', credsdir=None):

    """ return a list of userid and password and perhaps other data """

    if credsdir is None:

    credsdir = os.path.join(credsroot, project)

    creds = list()

    fname = os.path.join(credsdir, fname).replace("\\", "/")

    with open(fname, 'r') as f:

    for line in f:

    # remove leading/trailing whitespace and append to list

    creds.append(line.strip())

    assert creds, "The list of credentials is empty"

    return creds


On 11/01/2018 7:20 AM, yingi keme wrote:

Hi jason,

Ok so do you suggest moving secret keys to an environment variable 
because i am seeing tutorials on that, but its typically on the 
development stage. In production level, how will you do that..?


Yingi Kem

On 10 Jan 2018, at 3:01 PM, Jason > wrote:


Etienne, I think this is more related to having secrets outside of 
your code repository than actually on the server.  Having your AWS 
and db creds in your github repo, whether public or private, is a 
pretty bad thing to do.

--
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/52e78880-3127-42c3-b2de-50a451b22072%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/83521899-2750-46CA-9F31-B63BA827724B%40gmail.com 


Re: Handling secret keys in digitalocean

2018-01-10 Thread Joe
In addition to all of the reasons Jason posted, a private GitHub repository 
does not guarantee you any security of your data. 
>From https://help.github.com/articles/github-terms-of-service/ :

"GitHub does not warrant that the Service will meet your requirements; that 
the Service will be uninterrupted, timely, secure, or error-free; that the 
information provided through the Service is accurate, reliable or 
correct..."

Additionally: "You understand and agree that we will not be liable to you 
or any third party for any loss of profits, use, goodwill, or data, or for 
any incidental, indirect, special, consequential or exemplary damages, 
however arising, that result from

the use, disclosure, or display of your User-Generated Content;
your use or inability to use the Service;
any modification, price change, suspension or discontinuance of the Service;
the Service generally or the software or systems that make the Service 
available;
unauthorized access to or alterations of your transmissions or data;
statements or conduct of any third party on the Service;
any other user interactions that you input or receive through your use of 
the Service; or
any other matter relating to the Service."

On top of this, it is a security anti-pattern and a generally accepted poor 
practice to store private data in any repository. In fact, that is enough 
to fail an audit with some compliance levels.

On Wednesday, January 10, 2018 at 5:13:36 PM UTC-5, Etienne Robillard wrote:
>
>
>
> Le 2018-01-10 à 17:04, Jason a écrit :
>
> Since my work stuff is on Apache, I use this advice from two scoops of 
> django. 
>
> Etienne, are you really saying you have your AWS and database credentials, 
> usernames and passwords in your project repositories?  *ouch*  
>
>
>
> I dont save clear-text passwords in Django settings for security reasons. 
>
> Except I don't mind putting API keys and Django-specific data like 
> SECRET_KEY inside a private code repository.
>
> Cheers,
>
> Etienne
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/829ffc12-1ffa-4dba-b8ee-4ad25db74ae0%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> -- 
> Etienne robillardtka...@yandex.com 
> https://www.isotopesoftware.ca/
>
>

-- 
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/6741884b-df9b-40d7-be5f-8440c8e56644%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Handling secret keys in digitalocean

2018-01-10 Thread Etienne Robillard



Le 2018-01-10 à 17:04, Jason a écrit :
Since my work stuff is on Apache, I use this advice from two scoops of 
django.


Etienne, are you really saying you have your AWS and database 
credentials, usernames and passwords in your project repositories? /ouch/



I dont save clear-text passwords in Django settings for security reasons.

Except I don't mind putting API keys and Django-specific data like 
SECRET_KEY inside a private code repository.


Cheers,

Etienne



--
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/829ffc12-1ffa-4dba-b8ee-4ad25db74ae0%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
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/a6ca2bbe-1803-47a1-dc1f-29bb2a73196b%40yandex.com.
For more options, visit https://groups.google.com/d/optout.


Re: Handling secret keys in digitalocean

2018-01-10 Thread Jason
https://www.helpnetsecurity.com/2014/03/24/1-github-users-inadvertently-reveal-their-aws-secret-access-keys/

https://www.theregister.co.uk/2015/01/06/dev_blunder_shows_github_crawling_with_keyslurping_bots/

https://fossbytes.com/hacker-trufflehog-secret-keys-github/

-- 
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/9d977a6f-a42b-4592-b42e-5488c693f35f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Django ORM temporal tables with PostgreSQL

2018-01-10 Thread Matthew Pava
Temporal tables are not part of Django, but you could try to manually make 
them.  Saying that, it appears that are at least a couple of Django packages 
that try to make it easier to use them in the ORM.
This one looks decent, but its build is not passing:  
https://github.com/arkhipov/temporal_tables
This one looks like it just started:  https://github.com/zejn/django_temporal



From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of D_lane
Sent: Wednesday, January 10, 2018 10:09 AM
To: Django users
Subject: Django ORM temporal tables with PostgreSQL

Hey all,

I am lost with this topic.. I am fairly comfortable using Python to interact 
with PostgreSQL and generate temporal tables. However, when it comes to using 
the Django ORM I am finding it next to impossible to find links or any examples 
online ..

Any suggestions where to find some material on this topic would be great.

Kind Regards,
Donal
--
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/a337d120-a49d-4b54-a567-4f102c8c90de%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/3379747a8ff343819b457299f69c6eef%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: Handling secret keys in digitalocean

2018-01-10 Thread yingi keme
Hi Etienne,

I will thoroughly investigate which is the best approach.


Yingi Kem

> On 10 Jan 2018, at 8:35 PM, Etienne Robillard  wrote:
> 
> Hi Jason,
> 
> I understand your views. But I have trust in Digital Ocean and Github that 
> they will not mess with "private" stuff unless they want to expose themselves 
> to lawsuits.
> 
> Personally, I don't care using a code repository to save Django-specific 
> data. 
> Cheers,
> 
> Etienne
> 
>> Le 2018-01-10 à 09:01, Jason a écrit :
>> Etienne, I think this is more related to having secrets outside of your code 
>> repository than actually on the server.  Having your AWS and db creds in 
>> your github repo, whether public or private, is a pretty bad thing to do.
>> -- 
>> 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/52e78880-3127-42c3-b2de-50a451b22072%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> Etienne Robillard
> tkad...@yandex.com
> https://www.isotopesoftware.ca/
> -- 
> 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/f28057cd-c300-c8e4-dbe7-52d155328db3%40yandex.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/F2BB3183-8695-44F0-8057-5251E3F9508F%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Handling secret keys in digitalocean

2018-01-10 Thread yingi keme
Hi jason,

Ok so do you suggest moving secret keys to an environment variable because i am 
seeing tutorials on that, but its typically on the development stage. In 
production level, how will you do that..?

Yingi Kem

> On 10 Jan 2018, at 3:01 PM, Jason  wrote:
> 
> Etienne, I think this is more related to having secrets outside of your code 
> repository than actually on the server.  Having your AWS and db creds in your 
> github repo, whether public or private, is a pretty bad thing to do.
> -- 
> 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/52e78880-3127-42c3-b2de-50a451b22072%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/83521899-2750-46CA-9F31-B63BA827724B%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Handling secret keys in digitalocean

2018-01-10 Thread Etienne Robillard

Hi Jason,

I understand your views. But I have trust in Digital Ocean and Github 
that they will not mess with "private" stuff unless they want to expose 
themselves to lawsuits.


Personally, I don't care using a code repository to save Django-specific 
data.


Cheers,

Etienne


Le 2018-01-10 à 09:01, Jason a écrit :
Etienne, I think this is more related to having secrets outside of 
your code repository than actually on the server.  Having your AWS and 
db creds in your github repo, whether public or private, is a pretty 
bad thing to do.

--
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/52e78880-3127-42c3-b2de-50a451b22072%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
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/f28057cd-c300-c8e4-dbe7-52d155328db3%40yandex.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django ORM temporal tables with PostgreSQL

2018-01-10 Thread Jason
Check out
https://docs.djangoproject.com/en/2.0/topics/db/queries/
https://tutorial.djangogirls.org/en/django_orm/
https://opensource.com/article/17/11/django-orm


-- 
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/fee6f83d-8a8c-485c-bf39-74e0aceb0fe7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django ORM temporal tables with PostgreSQL

2018-01-10 Thread D_lane
Hey all, 

I am lost with this topic.. I am fairly comfortable using Python to 
interact with PostgreSQL and generate temporal tables. However, when it 
comes to using the Django ORM I am finding it next to impossible to find 
links or any examples online .. 

Any suggestions where to find some material on this topic would be great.

Kind Regards, 
Donal  

-- 
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/a337d120-a49d-4b54-a567-4f102c8c90de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Simple file uploading app

2018-01-10 Thread guettli


Am Dienstag, 9. Januar 2018 01:08:48 UTC+1 schrieb Mike Morris:
>
> Though it is not a Drupal app, there is an excellent drop box type app in 
> PHP called "Download Ticket Service"... simple, no frills, entirely 
> cross-platform and open:
>
> http://www.thregr.org/~wavexx/software/dl/
> I have no idea if it could be readily incorporated into your app, but just 
> FYI
>
>

Yes, this php project does a lot. My uploader does much less. But maybe we 
could agree on the basic http stuff...



>From their website:
>
> “dl” is a simple file sharing service for quick/one-off file transfers. 
> Upload a file to get a link you can share. Or create a sharing link to 
> receive files from others. The uploaded files are automatically removed 
> when left unused, requiring zero additional maintenance.
>
> “dl” is *built for your users*: easy to use with any browser, integrates 
> smoothly with Thunderbird 
>  for large 
> attachments, works on Android 
> , Windows, OSX 
>  or straight from 
> the command line 
> 
>  for maximum convenience.
>
>
>
>
>
>
> On 01/08/2018 04:16 AM, guettli wrote:
>
> Just for the records: Since I found no matching solution I wrote a generic 
> http upload tool: https://pypi.python.org/pypi/tbzuploader/
>
> For ftp there are thousands of clients, for automated upload via http I 
> found none. That's why I wrote above tool.
>
> Regards,
>   Thomas
>
> Am Mittwoch, 25. Oktober 2017 16:57:31 UTC+2 schrieb guettli: 
>>
>> I need a simple file uploading app.
>>
>> Every user should be able to upload files to his own area.
>>
>> This is the basic feature. You could think of additional goodies, but the 
>> first step is
>> above feature.
>>
>> I tried to find an application which implements this, but failed.
>>
>> I tried this and other searches:
>>
>> https://djangopackages.org/search/?q=upload
>>
>>
>> Before I start coding, I wanted to ask here, because I prefer re-using to 
>> re-inventing :-)
>>
>> Do you know an app which gives me this feature?
>>
>> Regards,
>>   Thomas Güttler
>>
>>
>> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/016f37e6-3d91-40bc-bef5-8da625125117%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/ea66ee06-b01c-4972-a3ce-db8089a5e7af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Admin case-insensitive sorting question

2018-01-10 Thread Matthew Pava
If I'm understanding you correctly, you could use a callable in the 
list_display definition.
https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

def lower_case_name(obj):
return ("%s" % str(obj).lower()
lower_case_name.short_description = 'Substance'

class SubstanceAdmin(admin.ModelAdmin):
list_display = (lower_case_name,)

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Mike Dewhirst
Sent: Wednesday, January 10, 2018 1:03 AM
To: Django users
Subject: Admin case-insensitive sorting question

I have tried every which way to produce a case-insenstive list of substances in 
the Admin including this:

def get_queryset(self, request):
     return super(SubstanceAdmin,
self).get_queryset(request).order_by(Lower('name').asc())

Which DOES work (as proven via print statement) but doesn't display that way in 
the Admin which uses the natural ascii order. It is the list_display feature 
which re-orders the substances.

I can get them sorting pseudo-insensitively by using a method to uppercase the 
first char of the name and passing that method to list_display.

However, that prevents the column order reversal feature which is a function of 
the list_display feature.

I thought a case insensitive model manager might work until I saw in the docs 
that subsequent order_by filtering will spoil it and I would still have to 
pseudo_name them anyway.

So the question is ... should I bite the bullet and add a sort field to the 
model and fill it with the substance name converted to lower-case?

Thanks

Mike

--
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/b1fc1d23-b0ab-d35e-9049-9a4f6091a4f7%40dewhirst.com.au.
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/205b80f44a9f47569f5715825dc2c106%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: Split API URLs to second project/settings/wsgi ?

2018-01-10 Thread guettli
By chance I saw this in the authenticate() docs:

https://docs.djangoproject.com/en/2.0/topics/auth/default/#django.contrib.auth.authenticate

 Changed in Django 1.11: The optional request argument was added.

Maybe this is the reason why DRF did his own auth handling in the past.

Regards,
  Thomas Güttler

Am Donnerstag, 4. Januar 2018 16:54:38 UTC+1 schrieb guettli:
>
>
>
> Am Mittwoch, 3. Januar 2018 17:40:51 UTC+1 schrieb Jason:
>>
>> Sounds like this is a good use case to integrate DRF to solve multiple 
>> problems.
>>
>>
>>
> I am unsure. I would like to have auth solved by the framework. With 
> framework I mean django.
>
>

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


Re: Convert Excel code to Python

2018-01-10 Thread johnf
I did not realize that the old app was so large.  I think I would take a 
different approach to the problem and not the one you are suggesting - 
to convert the VBA to python.  Django and excel are very different 
animals.  In my opinion you are trying to mix apples and oranges and 
that never works well.  I would review each form and determine the data 
requirements and come up with a database schema.  You might then 
consider using a REST interface for the data - including functions 
requirements.  Then review the UI and determine if the there is a better 
way to present the data (or gather the data).  I would not make any 
attempt to recreate the UI but follow the requirements and create a UI 
that meets the requirements.  IMO this is a completely new project.    
All the excel does for you is provide a guide - nothing like a solution. 
Attempting to use some sort of converted VBA code will only cause you to 
have a bad Django project.


Johnf


On 01/09/2018 09:53 PM, BIJAL MANIAR wrote:


Hi,
Thanks all for reply.
Since it is an old application there is no documentation for it. I 
will have to do Reverse Engineering by looking at vbscript code and 
gathering requirements.
Total there are 40 screens. A single form has 20-30 input parameters 
to select from and generate output depending on that. There are 
validation for combination of few input parameters as well. I can code 
in python but want some suggestion on approach to be followed.


I know fully automated tools are not available. Has anyone used vb2py 
or any such libraries for such requirement and how accurate it was?


Thanks,
Bijal

On Tuesday, January 9, 2018 at 6:45:55 PM UTC+5:30, BIJAL MANIAR wrote:


Hi,

There is an old application in Excel where macros are coded in
VBScript and there is both frontend (forms) and backend in Excel.
Need to replicate it as a web application (Python, Django, React).
From scratch, have to build it in python.
I have checked vb2py library is there for code conversion but it
has limitations. Can anyone please guide me if any tools are
available to convert code from vbscript to python?

Thanks,
Bijal

--
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/69a6524b-ffbc-4c32-bba6-7c6e40746832%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/c3af07f7-81da-de76-f948-1aa723049d22%40jfcomputer.com.
For more options, visit https://groups.google.com/d/optout.


Re: Handling secret keys in digitalocean

2018-01-10 Thread Jason
Etienne, I think this is more related to having secrets outside of your 
code repository than actually on the server.  Having your AWS and db creds 
in your github repo, whether public or private, is a pretty bad thing to do.

-- 
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/52e78880-3127-42c3-b2de-50a451b22072%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: HTML video seek problem in django

2018-01-10 Thread Julio Biason
Hi Manjunatha,

Django just serves the content, it doesn't handle how it will be played. It
could be a problem with your player, or some JS error -- in other words,
nothing to do with Django itself.

On Wed, Jan 10, 2018 at 8:03 AM, Manjunatha L Naik 
wrote:

> Hii,
>
>
>
> When load video from Django app, the video seeking(forward and backward)
> is not possible with chrome browser. It works fine with IE and Mozilla
> Firefox.. Please help me out.
>
>
>
> 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/57db425c-e1fc-406d-85df-570a512751a4%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


HTML video seek problem in django

2018-01-10 Thread Manjunatha L Naik


Hii,

 

When load video from Django app, the video seeking(forward and backward) is 
not possible with chrome browser. It works fine with IE and Mozilla 
Firefox.. Please help me out.

 

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/57db425c-e1fc-406d-85df-570a512751a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Newbie : Help for using RequestContext

2018-01-10 Thread mickael . barbo
Oh, 
*Thank you Andréas for your kind attention and your reactivity.*
Nice, I didn't know about request.session... And thanks to you, *now I Know* 
:-)

Just for archive, I found a way with context_processors here (old django 
version, but I adapt to django 2) :
http://apprendre-python.com/page-django-context-processor-template

Very happy to join Django community :D

Micka

Le mercredi 10 janvier 2018 09:36:46 UTC+1, Andréas Kühne a écrit :
>
> Hi Micka,
>
> And welcome to django.
>
> Regarding how to add things in middleware - you can add the information to 
> the session like this:
>
> class SimpleBreadcrumbs(object):
> def __init__(self, get_response):
> self.get_response = get_response
> # One-time configuration and initialization.
>
>
> def __call__(self, request):
> # Code to be executed for each request before
> # the view (and later middleware) are called.
>
> request.session['breadcrumbs'] = {"level0": "Adrian", "level1": 
> "Thomas"}
>
> response = self.get_response(request)
>
>
> # Code to be executed for each request/response after
> # the view is called.
>
> return response
>
>
> Then in your templates you can do this:
>
> {% extends 'pricing/body.html' %}
>
> {% block content %}
>
> {{ breadcrumbs.level0 }} / {{ breadcrumbs.level1 }}
>
> {% endblock content %}
>
> Regards,
>
> Andréas
>
> 2018-01-10 0:42 GMT+01:00 >:
>
>> Hello to all Django users :-)
>>
>> I'm new to Django and this is my first post.
>>
>> I'd like to implement breadcrumbs on all my pages.
>>
>> My strategy is to create a middleware and to use RequestContext to
>> add a dict to the context of each request then use the context in my html
>>
>> My problem is that I don't understand how to link RequestContext to 
>> my request. Hereafter my code :
>>
>> my_middleware.py
>> from django.template import RequestContext
>>
>>
>> class SimpleBreadcrumbs(object):
>> def __init__(self, get_response):
>> self.get_response = get_response
>> # One-time configuration and initialization.
>>
>>
>> def __call__(self, request):
>> # Code to be executed for each request before
>> # the view (and later middleware) are called.
>>
>> request_context = RequestContext(request)
>> request_context.push({"level0": "Adrian", "level1": "Thomas"})
>>
>> response = self.get_response(request)
>>
>>
>> # Code to be executed for each request/response after
>> # the view is called.
>>
>> return response
>>
>>
>> my_template.html
>>
>> {% extends 'pricing/body.html' %}
>>
>> {% block content %}
>>
>> {{ level0 }}
>>
>> {% endblock content %}
>>
>>
>> What I'm doing wrong ?
>>
>> Thx for your help
>>
>> Micka
>> Django newbie
>> ;-)
>>
>>
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/6cf0e65a-2b48-4bbb-a8a7-0351252e49f9%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/e6de4d19-7778-4988-abbf-3906a134bc42%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Handling secret keys in digitalocean

2018-01-10 Thread Etienne Robillard

Hi,

I think this is paranoia. Unless you allow root access to your droplet 
without password or pubkey authentication, there's no way anyone can 
gain access to your settings.py file.


cheers,

Etienne


Le 2018-01-10 à 06:10, Antonis Christofides a écrit :

Hello,

this is actually a big question that is a pain for lots of people. The other
time I held a webinar and I spent some time on this; if you are interested it's
at https://www.crowdcast.io/e/deploying-django, and together with the related
question about different settings in development vs. deployment, I start
treating this issue at 38m10s.

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com

On 2018-01-10 11:34, yingi keme wrote:

I am aware that its a bad idea to put your secret keys and other API keys in 
your settinggs.py file.

In a production environment like for instance hosting your site in 
digitalocean, where will you have to store your secret keys. And how will you 
load it in your settings.py file.?

I am a newbie when it comes to deploying, anyhelp will please.!!!



--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
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/263877a6-942e-f1e3-ddb2-65a627ba1d7a%40yandex.com.
For more options, visit https://groups.google.com/d/optout.


Re: varchar and text

2018-01-10 Thread Antonis Christofides
Hello,

this is an RDBMS question, not a django question, so if you search the web
without including "django" in the search you will probably get the answer. For
example, I'm searching with "difference between varchar and text" and it returns
nice results (most about MySQL, but in PostgreSQL the principles are the same,
although the details might differ).

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com


On 2018-01-10 12:36, Rakhee Menon wrote:
> Hello!!!
> I am using django with postgresql..
> I am just not getting the difference between varchar and text..
> Can someone clear my doubt??
> -- 
> 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/102891a1-b5d7-4738-9506-a78bcdba304f%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/11ef795f-3d80-8df4-159c-007d7ee2196d%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


Re: Handling secret keys in digitalocean

2018-01-10 Thread Antonis Christofides
Hello,

this is actually a big question that is a pain for lots of people. The other
time I held a webinar and I spent some time on this; if you are interested it's
at https://www.crowdcast.io/e/deploying-django, and together with the related
question about different settings in development vs. deployment, I start
treating this issue at 38m10s.

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com

On 2018-01-10 11:34, yingi keme wrote:
> I am aware that its a bad idea to put your secret keys and other API keys in 
> your settinggs.py file. 
>
> In a production environment like for instance hosting your site in 
> digitalocean, where will you have to store your secret keys. And how will you 
> load it in your settings.py file.?
>
> I am a newbie when it comes to deploying, anyhelp will please.!!!
>

-- 
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/3273cbef-5b12-4ed5-0378-0dcf4f85c6c6%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


varchar and text

2018-01-10 Thread Rakhee Menon
Hello!!!
I am using django with postgresql..
I am just not getting the difference between varchar and text..
Can someone clear my doubt??

-- 
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/102891a1-b5d7-4738-9506-a78bcdba304f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django test command with --parallel

2018-01-10 Thread Yevhen Yevhen
Yes, it works without this flag. And I've found the cause -- custom mixins 
for TestCase class that performed tricky patching.

On Wednesday, January 10, 2018 at 12:03:44 PM UTC+2, Avraham Serour wrote:
>
> does it work without the parallel flag?
>
> On Wed, Jan 10, 2018 at 10:57 AM, Yevhen Yevhen  > wrote:
>
>> The same traceback from the pastebin link:
>>
>> Creating test database for alias 'default'...
>> Cloning test database for alias 'default'...
>> Cloning test database for alias 'default'...
>> System check identified no issues (0 silenced).
>> Traceback (most recent call last):
>>   File "manage.py", line 41, in 
>> main()
>>   File "manage.py", line 37, in main
>> execute_from_command_line(sys.argv)
>>   File 
>> "/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/core/management/__init__.py",
>>  
>> line 364, in execute_from_command_line
>> utility.execute()
>>   File 
>> "/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/core/management/__init__.py",
>>  
>> line 356, in execute
>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File 
>> "/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/core/management/commands/test.py",
>>  
>> line 29, in run_from_argv
>> super(Command, self).run_from_argv(argv)
>>   File 
>> "/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/core/management/base.py",
>>  
>> line 283, in run_from_argv
>> self.execute(*args, **cmd_options)
>>   File 
>> "/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/core/management/base.py",
>>  
>> line 330, in execute
>> output = self.handle(*args, **options)
>>   File 
>> "/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/core/management/commands/test.py",
>>  
>> line 62, in handle
>> failures = test_runner.run_tests(test_labels)
>>   File 
>> "/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/test/runner.py",
>>  
>> line 603, in run_tests
>> result = self.run_suite(suite)
>>   File 
>> "/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/test/runner.py",
>>  
>> line 567, in run_suite
>> return runner.run(suite)
>>   File 
>> "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/unittest/runner.py", line 
>> 176, in run
>> test(result)
>>   File "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/unittest/suite.py", 
>> line 84, in __call__
>> return self.run(*args, **kwds)
>>   File 
>> "/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/test/runner.py",
>>  
>> line 370, in run
>> subsuite_index, events = test_results.next(timeout=0.1)
>>   File 
>> "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/multiprocessing/pool.py", 
>> line 735, in next
>> raise value
>>   File 
>> "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/multiprocessing/pool.py", 
>> line 424, in _handle_tasks
>> put(task)
>>   File 
>> "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/multiprocessing/connection.py",
>>  
>> line 206, in send
>> self._send_bytes(_ForkingPickler.dumps(obj))
>>   File 
>> "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/multiprocessing/reduction.py",
>>  
>> line 51, in dumps
>> cls(buf, protocol).dump(obj)
>> _pickle.PicklingError: Can't pickle > 0x1093db730>: it's not the same object as unittest.case.TestCase.run
>>
>>
>>
>> On Tuesday, January 9, 2018 at 7:22:50 PM UTC+2, Yevhen Yevhen wrote:
>>>
>>> I try to run my django tests using --parallel flag but get the following 
>>> error 
>>> (pastebin) . How can I fix this?
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/3da47ff2-3ab4-40e9-becc-8c06362b1739%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/4ba1f7e4-238f-40bf-b2cc-9152b3b04106%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django test command with --parallel

2018-01-10 Thread Avraham Serour
does it work without the parallel flag?

On Wed, Jan 10, 2018 at 10:57 AM, Yevhen Yevhen  wrote:

> The same traceback from the pastebin link:
>
> Creating test database for alias 'default'...
> Cloning test database for alias 'default'...
> Cloning test database for alias 'default'...
> System check identified no issues (0 silenced).
> Traceback (most recent call last):
>   File "manage.py", line 41, in 
> main()
>   File "manage.py", line 37, in main
> execute_from_command_line(sys.argv)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/core/management/__init__.py", line 364, in
> execute_from_command_line
> utility.execute()
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/core/management/__init__.py", line 356, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/core/management/commands/test.py", line 29, in
> run_from_argv
> super(Command, self).run_from_argv(argv)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/core/management/base.py", line 283, in run_from_argv
> self.execute(*args, **cmd_options)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/core/management/base.py", line 330, in execute
> output = self.handle(*args, **options)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/core/management/commands/test.py", line 62, in handle
> failures = test_runner.run_tests(test_labels)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/test/runner.py", line 603, in run_tests
> result = self.run_suite(suite)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/test/runner.py", line 567, in run_suite
> return runner.run(suite)
>   File "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/unittest/runner.py",
> line 176, in run
> test(result)
>   File "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/unittest/suite.py",
> line 84, in __call__
> return self.run(*args, **kwds)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/test/runner.py", line 370, in run
> subsuite_index, events = test_results.next(timeout=0.1)
>   File 
> "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/multiprocessing/pool.py",
> line 735, in next
> raise value
>   File 
> "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/multiprocessing/pool.py",
> line 424, in _handle_tasks
> put(task)
>   File "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/
> multiprocessing/connection.py", line 206, in send
> self._send_bytes(_ForkingPickler.dumps(obj))
>   File 
> "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/multiprocessing/reduction.py",
> line 51, in dumps
> cls(buf, protocol).dump(obj)
> _pickle.PicklingError: Can't pickle  0x1093db730>: it's not the same object as unittest.case.TestCase.run
>
>
>
> On Tuesday, January 9, 2018 at 7:22:50 PM UTC+2, Yevhen Yevhen wrote:
>>
>> I try to run my django tests using --parallel flag but get the following 
>> error
>> (pastebin) . How can I fix this?
>>
>> --
> 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/3da47ff2-3ab4-40e9-becc-8c06362b1739%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/CAFWa6tKUyh4X5wvLvL66pJWPDUML2sg8zemvE%2Be3-O-UiVc%3DgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Handling secret keys in digitalocean

2018-01-10 Thread yingi keme
I am aware that its a bad idea to put your secret keys and other API keys in 
your settinggs.py file. 

In a production environment like for instance hosting your site in 
digitalocean, where will you have to store your secret keys. And how will you 
load it in your settings.py file.?

I am a newbie when it comes to deploying, anyhelp will please.!!!

-- 
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/85aeb439-35c1-4586-bac8-b7daeda3d87d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django test command with --parallel

2018-01-10 Thread Yevhen Yevhen
The same traceback from the pastebin link:

Creating test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
System check identified no issues (0 silenced).
Traceback (most recent call last):
  File "manage.py", line 41, in 
main()
  File "manage.py", line 37, in main
execute_from_command_line(sys.argv)
  File 
"/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/core/management/__init__.py",
 
line 364, in execute_from_command_line
utility.execute()
  File 
"/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/core/management/__init__.py",
 
line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/core/management/commands/test.py",
 
line 29, in run_from_argv
super(Command, self).run_from_argv(argv)
  File 
"/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/core/management/base.py",
 
line 283, in run_from_argv
self.execute(*args, **cmd_options)
  File 
"/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/core/management/base.py",
 
line 330, in execute
output = self.handle(*args, **options)
  File 
"/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/core/management/commands/test.py",
 
line 62, in handle
failures = test_runner.run_tests(test_labels)
  File 
"/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/test/runner.py",
 
line 603, in run_tests
result = self.run_suite(suite)
  File 
"/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/test/runner.py",
 
line 567, in run_suite
return runner.run(suite)
  File "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/unittest/runner.py", 
line 176, in run
test(result)
  File "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/unittest/suite.py", 
line 84, in __call__
return self.run(*args, **kwds)
  File 
"/Users/me/.virtualenvs/project/lib/python3.6/site-packages/django/test/runner.py",
 
line 370, in run
subsuite_index, events = test_results.next(timeout=0.1)
  File 
"/Users/me/.pyenv/versions/3.6.2/lib/python3.6/multiprocessing/pool.py", 
line 735, in next
raise value
  File 
"/Users/me/.pyenv/versions/3.6.2/lib/python3.6/multiprocessing/pool.py", 
line 424, in _handle_tasks
put(task)
  File 
"/Users/me/.pyenv/versions/3.6.2/lib/python3.6/multiprocessing/connection.py", 
line 206, in send
self._send_bytes(_ForkingPickler.dumps(obj))
  File 
"/Users/me/.pyenv/versions/3.6.2/lib/python3.6/multiprocessing/reduction.py", 
line 51, in dumps
cls(buf, protocol).dump(obj)
_pickle.PicklingError: Can't pickle : 
it's not the same object as unittest.case.TestCase.run



On Tuesday, January 9, 2018 at 7:22:50 PM UTC+2, Yevhen Yevhen wrote:
>
> I try to run my django tests using --parallel flag but get the following 
> error 
> (pastebin) . How can I fix this?
>
>

-- 
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/3da47ff2-3ab4-40e9-becc-8c06362b1739%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Newbie : Help for using RequestContext

2018-01-10 Thread Andréas Kühne
Hi Micka,

And welcome to django.

Regarding how to add things in middleware - you can add the information to
the session like this:

class SimpleBreadcrumbs(object):
def __init__(self, get_response):
self.get_response = get_response
# One-time configuration and initialization.


def __call__(self, request):
# Code to be executed for each request before
# the view (and later middleware) are called.

request.session['breadcrumbs'] = {"level0": "Adrian", "level1":
"Thomas"}

response = self.get_response(request)


# Code to be executed for each request/response after
# the view is called.

return response


Then in your templates you can do this:

{% extends 'pricing/body.html' %}

{% block content %}

{{ breadcrumbs.level0 }} / {{ breadcrumbs.level1 }}

{% endblock content %}

Regards,

Andréas

2018-01-10 0:42 GMT+01:00 :

> Hello to all Django users :-)
>
> I'm new to Django and this is my first post.
>
> I'd like to implement breadcrumbs on all my pages.
>
> My strategy is to create a middleware and to use RequestContext to
> add a dict to the context of each request then use the context in my html
>
> My problem is that I don't understand how to link RequestContext to
> my request. Hereafter my code :
>
> my_middleware.py
> from django.template import RequestContext
>
>
> class SimpleBreadcrumbs(object):
> def __init__(self, get_response):
> self.get_response = get_response
> # One-time configuration and initialization.
>
>
> def __call__(self, request):
> # Code to be executed for each request before
> # the view (and later middleware) are called.
>
> request_context = RequestContext(request)
> request_context.push({"level0": "Adrian", "level1": "Thomas"})
>
> response = self.get_response(request)
>
>
> # Code to be executed for each request/response after
> # the view is called.
>
> return response
>
>
> my_template.html
>
> {% extends 'pricing/body.html' %}
>
> {% block content %}
>
> {{ level0 }}
>
> {% endblock content %}
>
>
> What I'm doing wrong ?
>
> Thx for your help
>
> Micka
> Django newbie
> ;-)
>
>
>
>
>
> --
> 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/6cf0e65a-2b48-4bbb-a8a7-0351252e49f9%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/CAK4qSCem5X%2B4ess5bexkej_fs_TmG1vHMbxOzJco5bzU-sQyZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.