Re: Have mercy please!

2015-06-09 Thread Tim Graham
Hi Jon,

Please see a recent discussion on django-developers with similar complaints:
https://groups.google.com/d/topic/django-developers/WKpkv1hdVWU/discussion

There is also discussion on django-developers about revising the 
deprecation schedule to make it easier to upgrade from one LTS release to 
another:
https://groups.google.com/d/topic/django-developers/MTvOPDNQXLI/discussion

If you have any other actionable suggestions, feel free to add them to 
either thread.

Thanks,
Tim

On Tuesday, June 9, 2015 at 9:27:49 PM UTC-4, Jon Foster wrote:
>
> I've been involved with Django, on and off, since v0.96 or so. I love 
> Django and think its the most productive way to build rich websites with 
> custom defined content types. Throw in Django-CMS and things get pretty 
> darn cool.
>
> I was thrilled when Django reached v1.0 since it came with the promise of 
> having a consistent and stable API, specifically a lack of backwards 
> incompatible changes, unless required by security concerns. Unfortunately 
> this promise is routinely violated for various excuses. The bottom line is 
> none of the apps I've written have been able to survive any 2 point 
> upgrades (v+0.2). Single point upgrades usually only cause minor breakage.
>
> I realize the desire to grow things and I applaud it. But there is a 
> business issue here. I can't, in good conscience recommend Django as a site 
> platform to many of my small clients as they simply could not afford the 
> upkeep of a Django powered site. Especially if the site is e-commerce 
> related, where PCI, and responsible site operation, will require that we 
> stay current. In order to do so would require staying up with the constant 
> flow of backwards incompatible changes, combined with the time and effort 
> to reverse engineer and maintain contributed apps, which aren't keeping 
> pace either.
>
> With the current method of development on the Django platform, if I had 
> just a dozen sites of moderate complexity, it would become a full time job 
> just keeping them updated. Its complicated enough just finding the apps 
> that will actually work with each other to construct a site. But the 
> carefully constructed house of cards is virtually guaranteed to break with 
> the next update.
>
> So I ask, PLEASE return to and stick with the promise of API stability? 
> You promised and routinely point to that statement, while making backwards 
> incompatible changes. I want to spend more time working with Django, but I 
> need to know that my clients can rely on painless and cost effective 
> upgrades.
>
> Thanks for reading my complaint,
> Jon
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a8e7d2fd-31ad-4306-b9e0-5004b56a50b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Have mercy please!

2015-06-09 Thread Jon Foster
I've been involved with Django, on and off, since v0.96 or so. I love 
Django and think its the most productive way to build rich websites with 
custom defined content types. Throw in Django-CMS and things get pretty 
darn cool.

I was thrilled when Django reached v1.0 since it came with the promise of 
having a consistent and stable API, specifically a lack of backwards 
incompatible changes, unless required by security concerns. Unfortunately 
this promise is routinely violated for various excuses. The bottom line is 
none of the apps I've written have been able to survive any 2 point 
upgrades (v+0.2). Single point upgrades usually only cause minor breakage.

I realize the desire to grow things and I applaud it. But there is a 
business issue here. I can't, in good conscience recommend Django as a site 
platform to many of my small clients as they simply could not afford the 
upkeep of a Django powered site. Especially if the site is e-commerce 
related, where PCI, and responsible site operation, will require that we 
stay current. In order to do so would require staying up with the constant 
flow of backwards incompatible changes, combined with the time and effort 
to reverse engineer and maintain contributed apps, which aren't keeping 
pace either.

With the current method of development on the Django platform, if I had 
just a dozen sites of moderate complexity, it would become a full time job 
just keeping them updated. Its complicated enough just finding the apps 
that will actually work with each other to construct a site. But the 
carefully constructed house of cards is virtually guaranteed to break with 
the next update.

So I ask, PLEASE return to and stick with the promise of API stability? You 
promised and routinely point to that statement, while making backwards 
incompatible changes. I want to spend more time working with Django, but I 
need to know that my clients can rely on painless and cost effective 
upgrades.

Thanks for reading my complaint,
Jon

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/11e78690-2b5f-4e99-a377-62c19b74e333%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Keep selected option after form submission

2015-06-09 Thread James Schneider
You can remove that entire pasted section of code and replace it with {{
form.activity }}, Django will render it with the behavior you described.

-James
On Jun 9, 2015 5:02 PM, "Vijay Khemlani"  wrote:

> It doesn't answer the question, but why don't you want to render the field
> automatically?
>
> On Tue, Jun 9, 2015 at 6:47 PM,  wrote:
>
>> Hi,
>>
>> I have the same problem of this guy (
>> http://stackoverflow.com/questions/21884631/keeping-option-selected-after-form-is-submitted-in-django),
>> but I do not want to render a field like Daniel Roseman
>>  said in the
>> answer.
>>
>> Here is the code:
>>
>> > data-size="10">
>> {% for id, name in form.activity.field.choices %}
>> {% if form.activity.value == id %}
>> {{ name }}
>> {% else %}
>> {{ name }}
>> {% endif %}
>> {% endfor %}
>> 
>>
>>
>> Thanks in advance.
>>
>>  --
>> 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/a6a2db7a-e4b0-4281-b6db-6f31009ac68d%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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALn3ei0cQOhZA1ae%3DVozqdL3uxERTpfinYRBx1CncGiu3Tepmw%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVJg-R%3DOP1cn7wSMtecC5Y3%3DdnuO4xR%2BmGwy%3DP%2Bg9j7ZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Keep selected option after form submission

2015-06-09 Thread Vijay Khemlani
It doesn't answer the question, but why don't you want to render the field
automatically?

On Tue, Jun 9, 2015 at 6:47 PM,  wrote:

> Hi,
>
> I have the same problem of this guy (
> http://stackoverflow.com/questions/21884631/keeping-option-selected-after-form-is-submitted-in-django),
> but I do not want to render a field like Daniel Roseman
>  said in the answer.
>
> Here is the code:
>
>  data-size="10">
> {% for id, name in form.activity.field.choices %}
> {% if form.activity.value == id %}
> {{ name }}
> {% else %}
> {{ name }}
> {% endif %}
> {% endfor %}
> 
>
>
> Thanks in advance.
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a6a2db7a-e4b0-4281-b6db-6f31009ac68d%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei0cQOhZA1ae%3DVozqdL3uxERTpfinYRBx1CncGiu3Tepmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Simulating REMOTE_USER login with the test server

2015-06-09 Thread Mike Dewhirst

On 10/06/2015 7:07 AM, Gergely Polonkai wrote:

Hello,

I’m about to use the test server with REMOTE_USER based logins. I
already know how to set it up with my Apache based server, but I can see
no way of doing the same with the dev server (manage.py runserver). I
have tried setting the environment variable REMOTE_USER to a desired
value, as I saw some env vars in request.META earlier, but it doesn’t
seem to help. Does anybody know if this is possible, and if so, how?


You can also set up Apache locally as your dev server. I think the dev 
server is more convenient for automatic reloading after saving code 
changes but you can restart Apache easily enough to live with a little 
inconvenience during development of that part of your project.


Mike



Best,
Gergely

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CACczBU%2BX%2BHESqWb7P17LdmBB%2BysMZFo42ab_AsoerMBELp1_OQ%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55776B34.5010702%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Keep selected option after form submission

2015-06-09 Thread julio . lacerda
Hi,

I have the same problem of this guy 
(http://stackoverflow.com/questions/21884631/keeping-option-selected-after-form-is-submitted-in-django),
 
but I do not want to render a field like Daniel Roseman 
 said in the answer.

Here is the code:


{% for id, name in form.activity.field.choices %}
{% if form.activity.value == id %}
{{ name }}
{% else %}
{{ name }}
{% endif %}
{% endfor %}



Thanks in advance.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a6a2db7a-e4b0-4281-b6db-6f31009ac68d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to DRY, define a set of model-fields and reuse them as multiple instances

2015-06-09 Thread ThomasTheDjangoFan
Hi guys,

now this is kind of hard for me to explain, I hope that somebody 
understands what I actually want.

I am a python newbie and wonder if there is an easy solution.

*They say: DRY!!*



*My question is:How do a define an (abstract?) class including methods and 
fieldsand then attach it to a real mode with variants instants?*

*The data needs to be available as realy models.* types, so I can use it in 
forms.*

Hopefully this example makes it clear:


# I would love to keep it DRY and wonder if there is a solution for this in 
python?

# NOW THIS IS TOTALLY MADE UP
# Basically I would like to be able to define a definition of model-fields 
and functions
# and then be able to "attach" it to a model as various instances
class KidType (models.Model):
NAMEHOLDER = '' #nameholder

NAMEHOLDER_text = models.TextField()
NAMEHOLDER_timestamp_updated = models.DateTimeField(auto_now_add=False, 
auto_now=True)

def example_function_shared_among_types():
return str(self.NAMEHOLDER_text + self.NAMEHOLDER_timestamp_updated)

def set_NAMEHOLDER_text(value):
self.set_NAMEHOLDER_text(value)

#
class DataHolderModel(models.Model):
# Attach the above definition with different names
# and make them accessable
@attach (KidType, KidType.NAME = 'dataset1')
@attach (KidType, KidType.NAME = 'dataset2')
@attach (KidType, KidType.NAME = 'dataset3')

# Access the instances within the HolderModel:
data_holder = DataHolderModel()
data_holder.dataset1_text = 'value1'
data_holder.set_dataset1_text('value1')
data_holder.dataset2_text = 'value2'
data_holder.dataset3_text = 'value3'

Any ideas? Can I do something like this?

I am really thankful for your tips
Thomas


-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/defa37b3-ae0f-4518-8c6c-bfd99a01ccc1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: generating pdf report with django-easy-pdf

2015-06-09 Thread sum abiut
Thanks Jose,
i will try that out and see how it goes.

Cheers,
Sum

On Mon, Jun 1, 2015 at 9:44 AM, Jose Aguirre 
wrote:

>
> *You need to add the get method this:*
>>
>
>  def get(self, request, *args, **kwargs):
>
> """
> Handles GET request and returns HTTP response.
> """
> context = self.get_context_data(**kwargs)
> #data: dic, array, etc.
> values = [1,2,3,4,5]
> # add the data in the context
> context["values"] = values
>
> return self.render_to_response(context)
>
>
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/afe2127d-4b05-4584-bbb8-92a3435d78ad%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCf-y7bQJO-EQzJDbLv-Qp5-rcbMvgMcBonv1RcjvKMtbWvzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Simulating REMOTE_USER login with the test server

2015-06-09 Thread Gergely Polonkai
Hello,

I’m about to use the test server with REMOTE_USER based logins. I already
know how to set it up with my Apache based server, but I can see no way of
doing the same with the dev server (manage.py runserver). I have tried
setting the environment variable REMOTE_USER to a desired value, as I saw
some env vars in request.META earlier, but it doesn’t seem to help. Does
anybody know if this is possible, and if so, how?

Best,
Gergely

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBU%2BX%2BHESqWb7P17LdmBB%2BysMZFo42ab_AsoerMBELp1_OQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Bug in Django? It throws server error when context processor raises Http404

2015-06-09 Thread Erik Cederstrand

> Den 09/06/2015 kl. 18.54 skrev Alexey Grigoriev :
> 
> I found this issue in my big project. And then I started new Django project 
> from scratch, and reproduced the problem. 
> You can reproduce this bug: 
> 1) start new Django project
> 2) create context processor that raises Http404 
> 3) set Debug=False 
> 4) create custom '404.html' template
> And then you get Server Error Page, instead of 404 page

Please create a bug report and attach the code for your test project. That way, 
it's easier for everyone to reproduce.

Erik

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/77D00C42-920C-4EBD-95FD-6721F2214FA2%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Bug in Django? It throws server error when context processor raises Http404

2015-06-09 Thread Alexey Grigoriev
I found this issue in my big project. And then I started new Django project 
from scratch, and reproduced the problem. 
You can reproduce this bug: 
1) start new Django project
2) create context processor that raises Http404 
3) set Debug=False 
4) create custom '404.html' template
And then you get Server Error Page, instead of 404 page

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a1b08722-41d8-4faf-b91b-abc43d4fe225%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: push yahoo finance json data into database

2015-06-09 Thread Oscar Buijten
Oh, here's a part of the model that I forgot to include.

class MyichiHistoricalData(models.Model):
id = models.IntegerField(db_column='ID', primary_key=True)  # Field 
name made lowercase.
symbol = models.CharField(max_length=10, blank=True, null=True)
exchange = models.CharField(max_length=10, blank=True, null=True)
yahoo_symbol = models.CharField(max_length=15)
symbol_period = models.IntegerField()
timeframe = models.CharField(max_length=10, blank=True, null=True)
date = models.DateField(blank=True, null=True)
updated = models.DateTimeField()
open = models.DecimalField(max_digits=10, decimal_places=4, blank=True, 
null=True)
high = models.DecimalField(max_digits=10, decimal_places=4, blank=True, 
null=True)
low = models.DecimalField(max_digits=10, decimal_places=4, blank=True, 
null=True)
close = models.DecimalField(max_digits=10, decimal_places=4, 
blank=True, null=True)
volume = models.IntegerField(blank=True, null=True)
average_volume = models.IntegerField(blank=True, null=True)

Le lundi 8 juin 2015 22:09:05 UTC+2, Oscar Buijten a écrit :
>
> Hi there,
> The python learning curve seems to be steeper than expected :-(
> As yesterday, help converting my php app into python/django will be 
> appreciated.
>
> I have the following:
>
>   snip  ---
> from django.core.management.base import BaseCommand, CommandError
> import json
> from collections import OrderedDict
> from yahoo_finance import Share 
> from data.models import MyichiTickers, MyichiHistoricalData
>
> exchange  = 'AMS'
> startdate = '2014-04-25'
> enddate   = '2014-04-29'
> minimum_avg_daily_volume = '10'
>
> class Command(BaseCommand):
> def handle(self, *args, **options):
> from yahoo_finance import Share 
> from data.models import MyichiTickers
> tickers_for_exchange = MyichiTickers.objects.filter(exchange=exchange)[:2]
> if tickers_for_exchange:
> for tickerlist in tickers_for_exchange:
> ticker = Share(tickerlist.ticker) 
> if ticker.get_avg_daily_volume() > minimum_avg_daily_volume:
> data = json.dumps(ticker.get_historical(startdate, enddate))
> data = json.loads(data)
> print data
>
>   snip  ---
>
> It may not be perfect, but it works.
> I would need to get 'data' into the 'MyichiHistoricalData' model
>
> The output is like this;
>   snip  ---
> [{u'High': u'6.565', u'Symbol': u'AGN.AS', u'Adj_Close': u'6.31564', 
> u'Volume': u'4376000', u'Low': u'6.428', u'Date': u'2014-04-29', u'Close': 
> u'6.551', u'Open': u'6.435'}, {u'High': u'6.479', u'Symbol': u'AGN.AS', 
> u'Adj_Close': u'6.18742', u'Volume': u'3163200', u'Low': u'6.38', u'Date': 
> u'2014-04-28', u'Close': u'6.418', u'Open': u'6.428'}, {u'High': u'6.535', 
> u'Symbol': u'AGN.AS', u'Adj_Close': u'6.18259', u'Volume': u'4780100', 
> u'Low': u'6.379', u'Date': u'2014-04-25', u'Close': u'6.413', u'Open': 
> u'6.529'}]
> [{u'High': u'13.94', u'Symbol': u'AH.AS', u'Adj_Close': u'13.57496', 
> u'Volume': u'2706600', u'Low': u'13.70', u'Date': u'2014-04-29', u'Close': 
> u'13.92', u'Open': u'13.70'}, {u'High': u'13.735', u'Symbol': u'AH.AS', 
> u'Adj_Close': u'13.34091', u'Volume': u'2784700', u'Low': u'13.56', 
> u'Date': u'2014-04-28', u'Close': u'13.68', u'Open': u'13.565'}, {u'High': 
> u'13.675', u'Symbol': u'AH.AS', u'Adj_Close': u'13.23364', u'Volume': 
> u'3012500', u'Low': u'13.44', u'Date': u'2014-04-25', u'Close': u'13.57', 
> u'Open': u'13.545'}]
>   snip  ---
>
> Where I need help it so extract the keys and values and give them the 
> correct model field names in order to save them.
>
> It should be easy really, bt several hours of readin, searching, trial & 
> error haven't given me the trick yet
>
> Any suggestions?
>
> Thanks!
>
> Oscar
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/583b73b4-244f-4a14-95c6-eca2e81ff9ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: push yahoo finance json data into database

2015-06-09 Thread Oscar Buijten
Hi James,
Thanks for such a detailed response. I looked at all your links (and 
already had come across some of them)
I guess that my question wasn't specific enough :-(

The table (and model) are existing.
However, the keys that I retrieve in the output I shared do not correspond 
to (some of) the table fields.
So I am struggling to figure out how to push the values provided by key 
names that do not match the fieldnames into my table.

As an example;
the key Symbol needs to put it's value into field 'yahoo_symbol' in the 
model/table

If that would become really complicated I guess I could change the field 
names in the model/table, but I rather not as the trick in itself would 
help me with some other data as well (it's part of the learning curve I 
guess :-) ).

Thanks!
Oscar




Le lundi 8 juin 2015 22:09:05 UTC+2, Oscar Buijten a écrit :
>
> Hi there,
> The python learning curve seems to be steeper than expected :-(
> As yesterday, help converting my php app into python/django will be 
> appreciated.
>
> I have the following:
>
>   snip  ---
> from django.core.management.base import BaseCommand, CommandError
> import json
> from collections import OrderedDict
> from yahoo_finance import Share 
> from data.models import MyichiTickers, MyichiHistoricalData
>
> exchange  = 'AMS'
> startdate = '2014-04-25'
> enddate   = '2014-04-29'
> minimum_avg_daily_volume = '10'
>
> class Command(BaseCommand):
> def handle(self, *args, **options):
> from yahoo_finance import Share 
> from data.models import MyichiTickers
> tickers_for_exchange = MyichiTickers.objects.filter(exchange=exchange)[:2]
> if tickers_for_exchange:
> for tickerlist in tickers_for_exchange:
> ticker = Share(tickerlist.ticker) 
> if ticker.get_avg_daily_volume() > minimum_avg_daily_volume:
> data = json.dumps(ticker.get_historical(startdate, enddate))
> data = json.loads(data)
> print data
>
>   snip  ---
>
> It may not be perfect, but it works.
> I would need to get 'data' into the 'MyichiHistoricalData' model
>
> The output is like this;
>   snip  ---
> [{u'High': u'6.565', u'Symbol': u'AGN.AS', u'Adj_Close': u'6.31564', 
> u'Volume': u'4376000', u'Low': u'6.428', u'Date': u'2014-04-29', u'Close': 
> u'6.551', u'Open': u'6.435'}, {u'High': u'6.479', u'Symbol': u'AGN.AS', 
> u'Adj_Close': u'6.18742', u'Volume': u'3163200', u'Low': u'6.38', u'Date': 
> u'2014-04-28', u'Close': u'6.418', u'Open': u'6.428'}, {u'High': u'6.535', 
> u'Symbol': u'AGN.AS', u'Adj_Close': u'6.18259', u'Volume': u'4780100', 
> u'Low': u'6.379', u'Date': u'2014-04-25', u'Close': u'6.413', u'Open': 
> u'6.529'}]
> [{u'High': u'13.94', u'Symbol': u'AH.AS', u'Adj_Close': u'13.57496', 
> u'Volume': u'2706600', u'Low': u'13.70', u'Date': u'2014-04-29', u'Close': 
> u'13.92', u'Open': u'13.70'}, {u'High': u'13.735', u'Symbol': u'AH.AS', 
> u'Adj_Close': u'13.34091', u'Volume': u'2784700', u'Low': u'13.56', 
> u'Date': u'2014-04-28', u'Close': u'13.68', u'Open': u'13.565'}, {u'High': 
> u'13.675', u'Symbol': u'AH.AS', u'Adj_Close': u'13.23364', u'Volume': 
> u'3012500', u'Low': u'13.44', u'Date': u'2014-04-25', u'Close': u'13.57', 
> u'Open': u'13.545'}]
>   snip  ---
>
> Where I need help it so extract the keys and values and give them the 
> correct model field names in order to save them.
>
> It should be easy really, bt several hours of readin, searching, trial & 
> error haven't given me the trick yet
>
> Any suggestions?
>
> Thanks!
>
> Oscar
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4dc1dbc6-4645-4b4c-a09c-2f99b3569a9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: push yahoo finance json data into database

2015-06-09 Thread Oscar Buijten
Hi James,
Thanks for such a detailed response. I looked at all your links (and 
already had come across some of them)
I guess that my question wasn't specific enough :-(

The table (and model) are existing.
However, the keys that I retrieve in the output I shared do not correspond 
to (some of) the table fields.
So I am struggling to figure out how to push the values provided by key 
names that do not match the fieldnames into my table.
If that would become really complicated I guess I could change the field 
names in the model/table, but I rather not as the trick in itself would 
help me with some other data as well (it's part of the learning curve I 
guess :-) ).
Thanks!
Oscar


As an example;
the key Symbol needs to put it's value into field 'yahoo_symbol' in the 
model/table

Le lundi 8 juin 2015 22:09:05 UTC+2, Oscar Buijten a écrit :
>
> Hi there,
> The python learning curve seems to be steeper than expected :-(
> As yesterday, help converting my php app into python/django will be 
> appreciated.
>
> I have the following:
>
>   snip  ---
> from django.core.management.base import BaseCommand, CommandError
> import json
> from collections import OrderedDict
> from yahoo_finance import Share 
> from data.models import MyichiTickers, MyichiHistoricalData
>
> exchange  = 'AMS'
> startdate = '2014-04-25'
> enddate   = '2014-04-29'
> minimum_avg_daily_volume = '10'
>
> class Command(BaseCommand):
> def handle(self, *args, **options):
> from yahoo_finance import Share 
> from data.models import MyichiTickers
> tickers_for_exchange = MyichiTickers.objects.filter(exchange=exchange)[:2]
> if tickers_for_exchange:
> for tickerlist in tickers_for_exchange:
> ticker = Share(tickerlist.ticker) 
> if ticker.get_avg_daily_volume() > minimum_avg_daily_volume:
> data = json.dumps(ticker.get_historical(startdate, enddate))
> data = json.loads(data)
> print data
>
>   snip  ---
>
> It may not be perfect, but it works.
> I would need to get 'data' into the 'MyichiHistoricalData' model
>
> The output is like this;
>   snip  ---
> [{u'High': u'6.565', u'Symbol': u'AGN.AS', u'Adj_Close': u'6.31564', 
> u'Volume': u'4376000', u'Low': u'6.428', u'Date': u'2014-04-29', u'Close': 
> u'6.551', u'Open': u'6.435'}, {u'High': u'6.479', u'Symbol': u'AGN.AS', 
> u'Adj_Close': u'6.18742', u'Volume': u'3163200', u'Low': u'6.38', u'Date': 
> u'2014-04-28', u'Close': u'6.418', u'Open': u'6.428'}, {u'High': u'6.535', 
> u'Symbol': u'AGN.AS', u'Adj_Close': u'6.18259', u'Volume': u'4780100', 
> u'Low': u'6.379', u'Date': u'2014-04-25', u'Close': u'6.413', u'Open': 
> u'6.529'}]
> [{u'High': u'13.94', u'Symbol': u'AH.AS', u'Adj_Close': u'13.57496', 
> u'Volume': u'2706600', u'Low': u'13.70', u'Date': u'2014-04-29', u'Close': 
> u'13.92', u'Open': u'13.70'}, {u'High': u'13.735', u'Symbol': u'AH.AS', 
> u'Adj_Close': u'13.34091', u'Volume': u'2784700', u'Low': u'13.56', 
> u'Date': u'2014-04-28', u'Close': u'13.68', u'Open': u'13.565'}, {u'High': 
> u'13.675', u'Symbol': u'AH.AS', u'Adj_Close': u'13.23364', u'Volume': 
> u'3012500', u'Low': u'13.44', u'Date': u'2014-04-25', u'Close': u'13.57', 
> u'Open': u'13.545'}]
>   snip  ---
>
> Where I need help it so extract the keys and values and give them the 
> correct model field names in order to save them.
>
> It should be easy really, bt several hours of readin, searching, trial & 
> error haven't given me the trick yet
>
> Any suggestions?
>
> Thanks!
>
> Oscar
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e07755cc-69e2-4a64-b44c-04041ae6df32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to test email-verification in django-registration-redux application on localhost?

2015-06-09 Thread Luis Zárate
Put  SITE_ID = 1 in your settings file to fix this error


2015-06-09 7:01 GMT-06:00 akshat :

> You're using the Django "sites framework" without having set the SITE_ID 
> setting. Create a site in your database and set the SITE_ID setting or pass a 
> request to Site.objects.get_current() to fix this error
>
>



-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2B5VyM3sv4pf3Hs%3DjSzqeh5XsaRhMNLd-7-w4grG8Dr8AaAWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Bug in Django? It throws server error when context processor raises Http404

2015-06-09 Thread Kapil Mangtani
have you written the handler correctly?

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/efea54eb-f681-4879-b426-ff24b17b0eeb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Bug in Django? It throws server error when context processor raises Http404

2015-06-09 Thread Galia Ladiray
Maybe it does not find your custom 404.html (and gives you a 500 of not 
finding it)?
Try to use this template elsewhere with debug=True, just to see 

On Tuesday, June 9, 2015 at 1:22:44 PM UTC+2, Alexey Grigoriev wrote:
>
> Django doesn't catch django.http.Http404 exception in my context processor 
> when Debug=False and when I have custom '404.html' template. It just throws 
> Internal Server Error. Is it Django bug?
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f614eb02-bcde-49a4-bccc-da0162d084dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to test email-verification in django-registration-redux application on localhost?

2015-06-09 Thread akshat
I have made an django app which uses Django-Registration-redux application 
to registration and email verification of users.I am using 'Sites' 
framework also.How ever when I click register button email is not sent but 
instead I get this error message - 

You're using the Django "sites framework" without having set the SITE_ID 
setting. Create a site in your database and set the SITE_ID setting or pass a 
request to Site.objects.get_current() to fix this error


I want to add localhost:8000 to the django_site table in database.What is the 
right way to add localhost to sites and test email-verification here?


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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9565b5dc-15a0-4415-a729-aedf0e385750%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


error while using ActionForm with django-grappelli

2015-06-09 Thread Ashish Gupta
I am using Django 1.7.6 and django-grappelli 2.6.4 I have written custom 
admin actions and Action form which were working well in Django admin. But 
in grappelli when i select a admin action from the dropdown the pages 
reloads before i can select the values from the ActionForm in admin panel. 
Is that a bug or i have to change some setting ? The admin action require 
updates the selected entries based on the value provided in ActionForm.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/87a57d24-dda0-4d31-8c22-92aa99f14541%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Bug in Django? It throws server error when context processor raises Http404

2015-06-09 Thread Alexey Grigoriev
Django doesn't catch django.http.Http404 exception in my context processor 
when Debug=False and when I have custom '404.html' template. It just throws 
Internal Server Error. Is it Django bug?

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2dbc5d8f-83ad-4e57-9ca4-ff1ebfead804%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: heavy refactoring

2015-06-09 Thread Mike Dewhirst

On 9/06/2015 6:43 PM, Erik Cederstrand wrote:



Den 09/06/2015 kl. 10.09 skrev Mike Dewhirst
:

Does anyone have any experience with app-renames and maybe some
refactoring advice for me?

Maybe I don't even need to replace and destroy ...


If you wanted, you could set Meta.db_table for all models to the
current table name. Then you shouldn't need to migrate any data. In
your Python code, simply rename the directory and everything
referencing the app, and you should be good to go, unless your code
contains too much clever magic.


Not clever enough.



I can't remember if Django migrations detect table renames. If not,
and you want to rename the tables too, just issue raw "ALTER TABLE
name RENAME TO new_name" SQL in an empty migration.


Many thanks Erik

Mike



Erik



--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5576A92B.5070306%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: heavy refactoring

2015-06-09 Thread Erik Cederstrand

> Den 09/06/2015 kl. 10.09 skrev Mike Dewhirst :
> 
> Does anyone have any experience with app-renames and maybe some refactoring 
> advice for me?
> 
> Maybe I don't even need to replace and destroy ...

If you wanted, you could set Meta.db_table for all models to the current table 
name. Then you shouldn't need to migrate any data. In your Python code, simply 
rename the directory and everything referencing the app, and you should be good 
to go, unless your code contains too much clever magic.

I can't remember if Django migrations detect table renames. If not, and you 
want to rename the tables too, just issue raw "ALTER TABLE name RENAME TO 
new_name" SQL in an empty migration.

Erik

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2FED37F9-2951-4CA2-84AC-BA62D3C20010%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


heavy refactoring

2015-06-09 Thread Mike Dewhirst

With Django 1.7 and Postgres I want to change the name of an app.

From my initial investigation it looks like I need to create a new app 
with the desired name and then blow the old one away after pumping the 
data across.


Then comes the refactoring.

At the moment I just use a vanilla text editor (Textpad) on Windows. 
However, based on my observation of the occasional IDE wars on this list 
I have lately been toying with the idea of teaching myself to use PyCharm.


Does anyone have any experience with app-renames and maybe some 
refactoring advice for me?


Maybe I don't even need to replace and destroy ...

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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55769F2F.9070602%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.