Binding hand written HTML(form) or forms that are not created through djnago forms to django forms validation errors

2015-03-10 Thread Mahesh Thipparthi
Hi All,
Kindly help me with following questions.
 
Use case is this:
1. i have created a form manually ( not generated through django forms)
2. I am calling a Django view function upon submission.
3. validating the field through django form as i ensured that form names 
are same.

question is
1. How to pass on validation errors from Djnago form to non django forms?
Please suggest better ways to do this.

Note. I see one way is to jsonify the errors and reconstruct the DOM


Let me take an example.
I do not want to use Djnago generated form hence i have written my own 
login page:

**

*Login to Application*

* {% csrf_token %}*

**

**

*  User ID  *

*  *

**

* *

*  Password *

*  *

*  *

**

  **

*Sign 
in*

**

**

  **

* *
  
action is passed to view where i am trying to do this.

  def login_view(request):

if request.POST:

form = LoginForm(request.POST or None)

if form.is_valid():

username = form.cleaned_data['username']

password = form.cleaned_data['password']

user = authenticate(username=username, password=password)

login(request, user)

return HttpResponseRedirect(reverse("menu"))

else:

form = LoginForm()

  context = {"form": form,}
return render(request, "login.html", context)  

*when ther are form eeors invalid user id or pasword..waht is the way 
to pass valiadtion errors to "UNBOUND Form".*
*I personally see only way to return jason response and process it on 
unbound form?is there anyway djnago can directly pass validation errors 
to forms that are not created by djnago?*


-- 
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/6f74d6f9-1c29-4ce7-b2df-4f74b8fefb05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


GSoKites Virtual Classroom

2015-03-10 Thread Barclay Koin
*Hi am Barclay from Nairobi Kenya currently a student at Dedan kimathi 
University of Technology. Am applying for  GSoKites Virtual Classroom 
and would like to a part of the growing community.*

-- 
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/a166e492-fe8a-4aff-aa24-01c778d4f10c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Binding hand written HTML(form) or forms that are not created through djnago forms to django forms validation errors

2015-03-10 Thread Vijay Khemlani
Unbound forms have no validation errors as they haven't been filled yet by
the user.

I think you are trying to solve the wrong problem. Why are you creating
your form manually in the first place? Your HTML markup is easy to do with
Django forms and packages suck as crispy forms

On Tue, Mar 10, 2015 at 4:02 AM, Mahesh Thipparthi <
mahesh.thippar...@gmail.com> wrote:

> Hi All,
> Kindly help me with following questions.
>
> Use case is this:
> 1. i have created a form manually ( not generated through django forms)
> 2. I am calling a Django view function upon submission.
> 3. validating the field through django form as i ensured that form names
> are same.
>
> question is
> 1. How to pass on validation errors from Djnago form to non django forms?
> Please suggest better ways to do this.
>
> Note. I see one way is to jsonify the errors and reconstruct the DOM
>
>
> Let me take an example.
> I do not want to use Djnago generated form hence i have written my own
> login page:
>
> **
>
> *Login to Application*
>
> * "auth_login" %}  > {% csrf_token %}*
>
> **
>
> **
>
> *   name="username" >User ID  *
>
> *   ="username" placeholder="User name">*
>
> **
>
> * *
>
> *  Password *
>
> *   id="password" placeholder="Password">*
>
> *  *
>
> **
>
>   **
>
> *Sign
> in*
>
> **
>
> **
>
>   **
>
> * *
>
> action is passed to view where i am trying to do this.
>
>   def login_view(request):
>
> if request.POST:
>
> form = LoginForm(request.POST or None)
>
> if form.is_valid():
>
> username = form.cleaned_data['username']
>
> password = form.cleaned_data['password']
>
> user = authenticate(username=username, password=password)
>
> login(request, user)
>
> return HttpResponseRedirect(reverse("menu"))
>
> else:
>
> form = LoginForm()
>
>   context = {"form": form,}
> return render(request, "login.html", context)
>
> *when ther are form eeors invalid user id or pasword..waht is the way
> to pass valiadtion errors to "UNBOUND Form".*
> *I personally see only way to return jason response and process it on
> unbound form?is there anyway djnago can directly pass validation errors
> to forms that are not created by djnago?*
>
>
>  --
> 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/6f74d6f9-1c29-4ce7-b2df-4f74b8fefb05%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/CALn3ei2QUOPFLwqn8z2kLv261wNB5cfLPEAVm%3DbO2dYWGrrnJg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generic Relation in Legacy Database?

2015-03-10 Thread Nan

Thanks, Avraham -- I was planning to use inspectdb as a first step, and 
it's very handy in streamlining building models!

But that doesn't even begin to solve the problem of how a GFK modeled 
differently than Django's ORM does can be used as an actual foreign key.


On Sunday, March 8, 2015 at 1:07:56 PM UTC-4, Avraham Serour wrote:
>
> use inspectdb to start
>
> On Sun, Mar 8, 2015 at 5:31 PM, Nan > 
> wrote:
>
>>
>> Hi folks --
>>
>> I'm building out Django models to represent a legacy PHP app's database 
>> in order to throw together a quick admin panel.  Everything's working great 
>> except that the ORM of the other application represents generic relations 
>> slightly differently than Django's does.  I can't modify the DB schema 
>> because the legacy application has to continue to run.
>>
>> Django uses:
>>
>> int content_type_id
>> int object_id
>>
>> The existing DB essentially uses:
>>
>> string model_class_name
>> int object_id
>>
>> Is there a way to get Django's ORM to use these fields to represent a GFK 
>> relationship so I can use it in the admin?  I can add tables, just not 
>> modify existing ones.  Maybe an extra 1-to-1 mapping content types to 
>> legacy model names would help?  Maybe writing a GenericForeignKey 
>> subclass?  A quick look at the source suggests there are a lot of methods 
>> that will need to be overridden (by copy-pasting 40 lines and changing 
>> one), which doesn't sound like fun to maintain in the long run.
>>
>> Just wondering if anyone's done this before or has any tips before I dive 
>> in.
>>
>> 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/3ec838f1-34ff-46f1-9b94-d3b9ac905d19%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/65c6f173-b407-465c-aecf-0c0a018050c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Binding hand written HTML(form) or forms that are not created through djnago forms to django forms validation errors

2015-03-10 Thread Scot Hacker


On Tuesday, March 10, 2015 at 4:10:48 AM UTC-7, Mahesh Thipparthi wrote:
>
> Hi All,
> Kindly help me with following questions.
>  
> Use case is this:
> 1. i have created a form manually ( not generated through django forms)
> 2. I am calling a Django view function upon submission.
> 3. validating the field through django form as i ensured that form names 
> are same.
>

>From your example code, I'm guessing the reason why you don't want to use a 
Django form is because you need to have  Bootstrap classes  on the form 
elements. A much better way to skin this cat is to use a standard Django 
form and then render it out with 
django-bootstrap-forms: https://django-bootstrap-form.readthedocs.org/en/latest/

./s

-- 
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/58f66a37-a512-44c6-ac22-1e5958a70a6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generic Relation in Legacy Database?

2015-03-10 Thread Avraham Serour
for each field in the model you can specify the column name un the db, it
does have a default way of calculating that, but you can specify

in any case you can tell the django ORM that this field is not an int, it
is actually a foreign key, let me know if that works

what DB are you using? mysql?

On Tue, Mar 10, 2015 at 2:59 PM, Nan  wrote:

>
> Thanks, Avraham -- I was planning to use inspectdb as a first step, and
> it's very handy in streamlining building models!
>
> But that doesn't even begin to solve the problem of how a GFK modeled
> differently than Django's ORM does can be used as an actual foreign key.
>
>
> On Sunday, March 8, 2015 at 1:07:56 PM UTC-4, Avraham Serour wrote:
>>
>> use inspectdb to start
>>
>> On Sun, Mar 8, 2015 at 5:31 PM, Nan  wrote:
>>
>>>
>>> Hi folks --
>>>
>>> I'm building out Django models to represent a legacy PHP app's database
>>> in order to throw together a quick admin panel.  Everything's working great
>>> except that the ORM of the other application represents generic relations
>>> slightly differently than Django's does.  I can't modify the DB schema
>>> because the legacy application has to continue to run.
>>>
>>> Django uses:
>>>
>>> int content_type_id
>>> int object_id
>>>
>>> The existing DB essentially uses:
>>>
>>> string model_class_name
>>> int object_id
>>>
>>> Is there a way to get Django's ORM to use these fields to represent a
>>> GFK relationship so I can use it in the admin?  I can add tables, just not
>>> modify existing ones.  Maybe an extra 1-to-1 mapping content types to
>>> legacy model names would help?  Maybe writing a GenericForeignKey
>>> subclass?  A quick look at the source suggests there are a lot of methods
>>> that will need to be overridden (by copy-pasting 40 lines and changing
>>> one), which doesn't sound like fun to maintain in the long run.
>>>
>>> Just wondering if anyone's done this before or has any tips before I
>>> dive in.
>>>
>>> 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 http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/3ec838f1-34ff-46f1-9b94-d3b9ac905d19%
>>> 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/65c6f173-b407-465c-aecf-0c0a018050c6%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/CAFWa6tKvv6K%3DYxnabSruaU-q%2BtPEqp17SE1Lh04%3DZfAVMoPZVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generic Relation in Legacy Database?

2015-03-10 Thread ringemup

Avraham, are you at all familiar with Django’s GenericForeignKey model field?  

It relies on *two* fields in the model.  Django resolves a generic foreign key 
by looking up the content type (a FK to the content types table) to figure out 
what table to look for the object ID in.  Then it looks for the object ID (what 
would normally be the foreign key) in the table in question.

The problem is not the object ID.  The problem is that my table does not 
reference Django’s content types table and thus does not conform to what Django 
expects from a GenericForeignKey.  Django then won’t be able to tell which 
table to look up the object ID in.

And I’m using Postgres, but that shouldn’t matter in this case.


On Mar 10, 2015, at 10:47 AM, Avraham Serour  wrote:

> for each field in the model you can specify the column name un the db, it 
> does have a default way of calculating that, but you can specify
> 
> in any case you can tell the django ORM that this field is not an int, it is 
> actually a foreign key, let me know if that works
> 
> what DB are you using? mysql?
> 
> On Tue, Mar 10, 2015 at 2:59 PM, Nan  wrote:
> 
> Thanks, Avraham -- I was planning to use inspectdb as a first step, and it's 
> very handy in streamlining building models!
> 
> But that doesn't even begin to solve the problem of how a GFK modeled 
> differently than Django's ORM does can be used as an actual foreign key.
> 
> 
> On Sunday, March 8, 2015 at 1:07:56 PM UTC-4, Avraham Serour wrote:
> use inspectdb to start
> 
> On Sun, Mar 8, 2015 at 5:31 PM, Nan  wrote:
> 
> Hi folks --
> 
> I'm building out Django models to represent a legacy PHP app's database in 
> order to throw together a quick admin panel.  Everything's working great 
> except that the ORM of the other application represents generic relations 
> slightly differently than Django's does.  I can't modify the DB schema 
> because the legacy application has to continue to run.
> 
> Django uses:
> 
> int content_type_id
> int object_id
> 
> The existing DB essentially uses:
> 
> string model_class_name
> int object_id
> 
> Is there a way to get Django's ORM to use these fields to represent a GFK 
> relationship so I can use it in the admin?  I can add tables, just not modify 
> existing ones.  Maybe an extra 1-to-1 mapping content types to legacy model 
> names would help?  Maybe writing a GenericForeignKey subclass?  A quick look 
> at the source suggests there are a lot of methods that will need to be 
> overridden (by copy-pasting 40 lines and changing one), which doesn't sound 
> like fun to maintain in the long run.
> 
> Just wondering if anyone's done this before or has any tips before I dive in.
> 
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/3ec838f1-34ff-46f1-9b94-d3b9ac905d19%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/65c6f173-b407-465c-aecf-0c0a018050c6%40googlegroups.com.
> 
> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Django users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/django-users/CRGUNH0DkhU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAFWa6tKvv6K%3DYxnabSruaU-q%2BtPEqp17SE1Lh04%3DZfAVMoPZVg%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

How to make responsinator.com working with Django?

2015-03-10 Thread inoyon artlover KLANGRAUSCH
Hi there,

how can I get Django working with responsinator.com ?

Best regards! :)

-- 
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/f66b6024-a8f1-4dfb-bcf9-1c50d86e8613%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to modify and then recombine json response data without breaking json formatting

2015-03-10 Thread Bill Freeman
OK.  but I need more code context.  The if statement that does the
modification is clearly python, so at that point rspnsdata must be a python
dictionary, not a JSON string.  Yet, if I understand you correctly, it is
JSON to begin with (and you are using json.loads() to turn it into python
data so that you can manipulate it, but then you must later turn it back
into a JSON string (json.dumps()) to send as a response.  So there's lots
of code you haven't shown.  If the problem were where you're concentrating,
you would have found it.  Please expand the scope of what you're showing.

On Mon, Mar 9, 2015 at 3:35 PM, Henry Versemann 
wrote:

> OK here goes. The logic in the routine which I actually doing the
> modification to each individual JSON response looks like this:
>
> if str(objctTyp) == 'user':
> rspnsdata['name'] = lstobjct['name']
> rspnsdata['id'] = lstobjct['id']
>
>
> The routine which is doing this is receiving parameter data that looks
> like this when printed in string format in the windows command prompt
> window:
>
> The following piece of parameter data is actually what came back as my
> JSON response from the current secondary request that the application sent.
> rspnsdata=
>
> {
> u'participations': [],
> u'page_views':
> {
> u'2015-02-05T00:00:00-06:00': 1,
> u'2015-03-02T23:00:00-06:00': 1,
> u'2015-01-24T19:00:00-06:00': 1,
> u'2015-02-08T13:00:00-06:00': 1,
> u'2015-01-28T19:00:00-06:00': 1,
> u'2015-01-20T19:00:00-06:00': 1,
> u'2015-02-19T10:00:00-06:00': 2,
> u'2015-02-21T17:00:00-06:00': 1,
> u'2015-02-02T13:00:00-06:00': 1,
> u'2015-02-16T13:00:00-06:00': 1,
> u'2015-02-01T23:00:00-06:00': 2,
> u'2015-02-03T12:00:00-06:00': 2
> }
>
> }
>
> The following bit of parameter data was actually passed in as the data for
> the current student which the latest secondary request was sent for and
> whose associated data JSON data is shown above.
>
> lstobjct=
>
> {
> 'name': 'Brennan Kennedy',
> 'id':'8202'
> }
>
> The following parameter data type "user" indicates that 'name' and 'id'
> key data is passed in in the 'lstobjct' parameter and those key value pairs
> will be added to the received JSON data.
>
> objctTyp=
>
> user
>
> Hope this helps.
> Thanks.
>
> Henry
>
> On Monday, March 9, 2015 at 1:04:12 PM UTC-5, ke1g wrote:
>
>> If it's not the basics, then you haven't provided enough information to
>> allow someone to spot the problem.  If you post the code that is performing
>> the modification, someone may be able to spot the issue.
>>
>> On Mon, Mar 9, 2015 at 1:50 PM, Henry Versemann 
>> wrote:
>>
>>> Yes Id did do that. The problems I seem to be having only seem to happen
>>> whenever I modify the data before sending it. For many other requests that
>>> I'm sending and not modifying the data, before I send them back to the
>>> client I have no problems and everything is apparently parsed out ok by the
>>> javascript on the client side.
>>> Thanks.
>>>
>>> Henry
>>>
>>> On Monday, March 9, 2015 at 12:42:23 PM UTC-5, ke1g wrote:
>>>
 Did you remember to set the content type of your response to
 application/json?

 On Mon, Mar 9, 2015 at 1:18 PM, Henry Versemann 
 wrote:

> First to be clear up front let me say that I'm using Django1.7, Python
> 2.7.8, and the requests (Requests: HTTP for Humans
> ) 
> library
> version2.4.3 to build the application mentioned below.
>
> I have an application which needs to be able to process a single AJAX
> request as a series of related sub-requests sent to a remote API. Each
> sub-request response comes back in JSON format. The first of these
> sub-requests returns a list of students in a particular course, and the
> returned response data is a list containing student objects all in JSON
> format. A Django view code then strips outs the 'name' and 'id' of each
> student object in the list and builds it as an entry in another python 
> list
> to be used later(I'm using "json.loads()" to get to successfully the
> original JSON data returned in each reasponse). Then once this list is
> built it is passed to another view which then submits a different request,
> for each student "id", in the newly built list, to the same API, to return
> all student information (related to a particular course-id which is also
> passed in this second request), for the current student. Then the returned
> course-student information, for this second request, is also returned in
> JSON format.
>
> Everything up to this point works perfectly, but it is at this point
> that I believe my process is going wrong, when I try to modify the JSON
> data returned, form the second series of requests.
>
> My modifications seem to work

Re: How to make responsinator.com working with Django?

2015-03-10 Thread Vijay Khemlani
Your question is how to make a responsive website or something else?

On Tue, Mar 10, 2015 at 12:05 PM, inoyon artlover KLANGRAUSCH <
inoyonartlo...@googlemail.com> wrote:

> Hi there,
>
> how can I get Django working with responsinator.com ?
>
> Best regards! :)
>
> --
> 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/f66b6024-a8f1-4dfb-bcf9-1c50d86e8613%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/CALn3ei3qX4N-az3VzZKsFr6wwAEZ-S4w8aBamHvE0TQBbUnAJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to make responsinator.com working with Django?

2015-03-10 Thread inoyon artlover KLANGRAUSCH
Hi no. I did a responsive site with bootstrap. But when I enter the url in 
responinator,
nothing happens. ..

Am Dienstag, 10. März 2015 16:05:03 UTC+1 schrieb inoyon artlover 
KLANGRAUSCH:
>
> Hi there,
>
> how can I get Django working with responsinator.com ?
>
> Best regards! :)
>

-- 
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/17638018-fbcd-459f-955b-07da7e38edeb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Running middleware within ATOMIC_REQUESTS transaction

2015-03-10 Thread Marc Aymerich
Hi,
I have a middleware that performs some operations at the end of each
request.

What I have found is that middlewares do not run inside the ATOMIC_REQUESTS
transaction. But I want the ATOMIC_REQUESTS transaction to rollback if an
exception is being raised on my middleware.

Any idea on how to solve this?

Thanks!
-- 
Marc

-- 
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%2BDCN_vcGpq-i-pUEpcNNqyXw%3DKyLTO97xFUrv%2BhwgJ%2B68qySA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Running middleware within ATOMIC_REQUESTS transaction

2015-03-10 Thread Marc Aymerich
On Tue, Mar 10, 2015 at 5:12 PM, Marc Aymerich  wrote:

> Hi,
> I have a middleware that performs some operations at the end of each
> request.
>
> What I have found is that middlewares do not run inside the
> ATOMIC_REQUESTS transaction. But I want the ATOMIC_REQUESTS transaction to
> rollback if an exception is being raised on my middleware.
>
> Any idea on how to solve this?
>

Well, I supose I can grab the TransactionMiddleware from the previous
release and use that instead of ATOMIC_REQUESTS :)

https://github.com/django/django/blob/stable/1.7.x/django/middleware/transaction.py

-- 
Marc

-- 
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%2BDCN_tiBFumLxEOgwHx1%2B-OKmN-M4M%2B0totbe--2D%3DYHuny_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Running middleware within ATOMIC_REQUESTS transaction

2015-03-10 Thread Marc Aymerich
On Tue, Mar 10, 2015 at 5:15 PM, Marc Aymerich  wrote:

>
>
> On Tue, Mar 10, 2015 at 5:12 PM, Marc Aymerich 
> wrote:
>
>> Hi,
>> I have a middleware that performs some operations at the end of each
>> request.
>>
>> What I have found is that middlewares do not run inside the
>> ATOMIC_REQUESTS transaction. But I want the ATOMIC_REQUESTS transaction to
>> rollback if an exception is being raised on my middleware.
>>
>> Any idea on how to solve this?
>>
>
> Well, I supose I can grab the TransactionMiddleware from the previous
> release and use that instead of ATOMIC_REQUESTS :)
>
>
> https://github.com/django/django/blob/stable/1.7.x/django/middleware/transaction.py
>


Not that easy, it seems that now all transactions are aborted by the
middleware :( I'll keep looking




> --
>
Marc

-- 
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%2BDCN_tKn4wojnnzE%2B9CLvCKO8aPnEbB93J4HX%3DP02g9oOO%2BVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django OperationalError

2015-03-10 Thread Collin Anderson
Hi Petar,

I'm actually not sure why you want to call sqlflush. If you're trying to 
clear out the database, you may need to delete the migrations table 
manually, but it just might be simpler to delete the either database and 
re-create it, rather than the individual tables.

Collin

On Friday, March 6, 2015 at 11:24:19 PM UTC-5, Petar Pilipovic wrote:
>
> Hello Collin,
> No the problem is, i have tried to drop mine migrations whit python manage 
> sqlflush, then I have recreate the db whit 
> python manage.py migrate.
> Here this is the all operation whit python manage sqlflush, syncdb, 
> migrate . I have notice that there was no migration 
> to apply at the end, and the error is still there.
> Is there something else I can do, or how can I approach this differently.
> Best
> Petar
>
> On Fri, Mar 6, 2015 at 11:21 PM, Collin Anderson  > wrote:
>
>> Hi,
>>
>> The problem is that django_session doesn't exist in your database. Either 
>> it was never created or it was created and then later deleted.
>>
>> Does running manage.py migrate re-create it?
>>
>> Collin
>>
>> On Monday, March 2, 2015 at 11:36:51 PM UTC-5, Petar Pilipovic wrote:
>>>
>>> Hello James, sorry for not uploading mine answer on this mater, I was 
>>> busy whit something else this day, ok now back to mine Operational Error I 
>>> have got.
>>> I tried to google some solution to this problem had no luck, and I did 
>>> what have you told me.
>>> I heave done some 
>>> python manage.py sqlflush
>>>
>>> and that has gave me this output: 
>>>
>>> (django17)04:20 ~/mineDjango$ python manage.py sqlflush BEGIN;DELETE 
>>> FROM "django_admin_log";DELETE FROM "auth_permission";DELETE FROM 
>>> "auth_group";DELETE FROM "auth_group_permissions";DELETE FROM 
>>> "django_session";DELETE FROM "auth_user_groups";DELETE FROM 
>>> "auth_user_user_permissions";DELETE FROM "account_emailaddress";DELETE 
>>> FROM "django_site";DELETE FROM "profiles_profile";DELETE FROM 
>>> "auth_user";DELETE FROM "profiles_userstripe";DELETE FROM 
>>> "account_emailconfirmation";DELETE FROM "django_content_type";COMMIT;
>>>
>>> Then I have done 
>>> python manage.py syncdb python manage.py migrate
>>>
>>> Output of mine recreating tables are this:
>>> (django17)04:20 ~/mineDjango$ python manage.py syncdbOperations to 
>>> perform: Synchronize unmigrated apps: allauth, crispy_forms Apply all 
>>> migrations: account, sessions, admin, sites, profiles, contenttypes, 
>>> authSynchronizing apps without migrations: Creating tables... 
>>> Installing custom SQL... Installing indexes...Running migrations: No 
>>> migrations to apply.(django17)04:20 ~/mineDjango$ python manage.py 
>>> migrateOperations to perform: Synchronize unmigrated apps: allauth, 
>>> crispy_forms Apply all migrations: account, sessions, admin, sites, 
>>> profiles, contenttypes, authSynchronizing apps without migrations: 
>>> Creating tables... Installing custom SQL... Installing indexes...Running 
>>> migrations: No migrations to apply.
>>> Basically I have had no changes in mine attempt to drop and recreate 
>>> tables in mine application.
>>> The error is still there.
>>> Error:
>>> Environment:
>>>
>>>
>>>
>>>
>>> Request Method: GET
>>> Request URL: http://copser.pythonanywhere.com/
>>>
>>>
>>> Django Version: 1.7.2
>>> Python Version: 2.7.6
>>> Installed Applications:
>>> ('django.contrib.admin',
>>>  'django.contrib.auth',
>>>  'django.contrib.contenttypes',
>>>  'django.contrib.sessions',
>>>  'django.contrib.messages',
>>>  'django.contrib.staticfiles',
>>>  'profiles',
>>>  'crispy_forms',
>>>  'django.contrib.sites',
>>>  'allauth',
>>>  'allauth.account',
>>>  'stripe')
>>> Installed Middleware:
>>> ('django.contrib.sessions.middleware.SessionMiddleware',
>>>  'django.middleware.common.CommonMiddleware',
>>>  'django.middleware.csrf.CsrfViewMiddleware',
>>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>>  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>>>  'django.contrib.messages.middleware.MessageMiddleware',
>>>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>>>
>>>
>>>
>>>
>>> Template error:
>>> In template /home/copser/static/templates/home.html, error at line 40
>>>no such table: django_session
>>>30 :  
>>>
>>>
>>>
>>>
>>>31 : {% block content %}
>>>
>>>
>>>
>>>
>>>32 :  
>>>
>>>
>>>
>>>
>>>33 : 
>>>
>>>
>>>
>>>
>>>34 :   
>>>
>>>
>>>
>>>
>>>35 : 
>>>
>>>
>>>
>>>
>>>36 : 
>>>
>>>
>>>
>>>
>>>37 :  {#  >> src="{% static 'img/07.jpg' %}"/>  #}
>>>
>>>
>>>
>>>
>>>38 :
>>>
>>>
>>>
>>>
>>>39 : 
>>>
>>>
>>>
>>>
>>>40 :  {% if request.user.is_authenticated %} 
>>>
>>>
>>>
>>>
>>>41 : Hello {{ request.user }}
>>>
>>>
>>>
>>>
>>>42 : {% else %}
>>>
>>>
>>>
>>>
>>>43 :   
>>>
>>>
>>>
>>>
>>>44 : >> value="sczg1f8U4tWQRa8kgNJC1QsSBKAD9Lvw"> {% csrf_token %}
>>>
>>>
>>>
>

Re: Existing database - new project

2015-03-10 Thread Collin Anderson
Hi,

inspectdb makes step #1 much easier.

If you're not planning on removing some of the columns or restructuring 
things, I'd recommend #1.

Collin 

On Saturday, March 7, 2015 at 9:31:24 AM UTC-5, Derek wrote:
>
> I have taken route 1 before; its a bit more messy because you may have to 
> explicitly map your desired model names to the actual column names.  You 
> also face the issue of dealing with primary keys. 
>
> If you have the choice, and the current database is not in use anymore, I 
> would create a new one, using Django conventions (such as an auto-increment 
> primary key, with "unique_together" constraints) and then import the 
> existing data.  This has the added benefit of allowing you to validate the 
> existing data and ensure that you start with a 'clean' data set. 
>
> HTH
> Derek
>
> On Friday, 6 March 2015 23:39:33 UTC+2, Robert Daniels wrote:
>>
>> I understand it is possible to use an existing database on a new Django 
>> project. 
>>
>> As I see it, I have 2 choices.
>>
>> 1 - Use the existing database and deal with it in that fashion.
>>
>> or
>>
>> 2 - Create a new project to store the same type of data as if there were 
>> no existing database, Then write a separate export-import script to move 
>> the data from the existing db to the new structure. 
>>
>> Wondering if anyone has gone through the "good" and "bad" of each of 
>> these. I have about 100,000 records in the database, but moving the data 
>> across should not be that difficult as its a pretty flat model
>>
>

-- 
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/374949d8-09a9-4dcc-bdde-76dcd1d9f795%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing Django models using DJANGO_SETTINGS_MODULE

2015-03-10 Thread Collin Anderson
Hi,

Hmm... maybe try ChatRoom.objects.all().all() ? :)

If you run this, you can see if it's actually running sql or not:
import logging; logging.basicConfig(level=logging.DEBUG)

Are you sure you're using the same database? :)

Collin

On Sunday, March 8, 2015 at 8:41:30 AM UTC-4, Dheerendra Rathor wrote:
>
> I've a django project and I've few models like ChatRoom and Chat etc
>
> I'm accessing the ChatRooms from commandline using ipython as follow
> In [1]: import os
>
> In [2]: os.environ['DJANGO_SETTINGS_MODULE'] = 'chat_project.settings'
>
> In [3]: from chat.models import Chat, ChatRoom
>
> In [4]: ChatRoom.objects.all()
> Out[4]: [, , , 
> , , ,  07>, , , ,  Lab 15>, ]
>
> Now, I'm adding more ChatRooms through web interface - Lab 17, Lab 18 and 
> deleting Lab 10
> Now the new output of 
> In [5]: ChatRoom.objects.all()
>
> The output is still the same
> Out[5]: [, , , 
> , , ,  07>, , , ,  Lab 15>, ]
>
> the webinterface is running as wsgi application on gunicorn server. 
>
> I think the output on command line is not changed because the django 
> default model manager is accessing the objects from cache and not from 
> database itself. Is there anyway I can get the updated models here on 
> command line? Or can I force django ORM to fetch objects from database and 
> not from cache?
>
>

-- 
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/737ec68b-d2eb-46be-a86a-8703f665e4bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


fake button run a view and come back to the same page.

2015-03-10 Thread dk
I been trying to find information on how to make a button to run a python 
script in the back.
I do have a table with some buttons,  and I want to click in one, and 
behind doors, will run a python script.

since I don't know to much javascript or flask, or php I decided to make a 
link (later on I can make it look like a button)  that link will run the 
view witch is my script as subprocess and then 
return back again the view of my table,   
so basicly will click the button, will run the code, and redo the view that 
I was all ready in. something like this.

views:
def main_table(request):
list_of_files= here I get my files.
return render(request, "show_table", {"list":list_of_files})



def button_do_thing(request):
file = request.GET.get(file_name)
dosomething

main_table(request) # here is where I am actually calling again to the 
main table to redraw it on the browswer.

but I get the error:

The view mes.views.test_machine didn't return an HttpResponse object. It 
returned None instead.

I tought passing the request should do it?


any tips, tricks?  or an actual way to make the button run the script?

thanks guys =)   .





-- 
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/0b79832b-d3b0-4e2f-9d66-d92628903cfd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2015-03-10 Thread Collin Anderson
Hi,

To be clear, you should have this setting:
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]

and in your mysite/templates/admin/base_site.html you should have something 
like:

{% block branding %}
Polls 
Administration
{% endblock %}

Does that all look right?

Thanks,
Collin

On Sunday, March 8, 2015 at 3:09:19 PM UTC-4, Bryan Arguello wrote:
>
> Have you solved this problem, Andreas?  I am having the same issue and 
> have done
> everything that the tutorial described as well as everything that people 
> on this thread
> have suggested.
>
> On Sunday, November 16, 2014 at 12:15:59 PM UTC-6, Andreas Ka wrote:
>>
>> I am working through 
>> https://docs.djangoproject.com/en/1.7/intro/tutorial02 
>> 
>> so far all went fine - but now *templates changes just don't work.*
>>
>>
>>
>> I think there must be a flaw in that tutorial, something missing,
>> or something different in django 1.7.1 ?
>>
>> https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customize-the-admin-look-and-feel
>>
>>
>> my versions:
>>
>> python -c "import django; print(django.get_version())"
>> 1.7.1
>>
>> python --version
>> Python 2.7.3
>>
>>
>>
>> *SYMPTOM:*
>>
>> my changes in 
>> mysite/templates/admin/base_site.html   
>> are simply ignored.
>>
>>
>>
>> These are my files:
>>
>> mysite# tree
>> .
>> ├── db.sqlite3
>> ├── manage.py
>> ├── mysite
>> │   ├── __init__.py
>> │   ├── settings.py
>> │   ├── urls.py
>> │   └── wsgi.py
>> ├── polls
>> │   ├── admin.py
>> │   ├── __init__.py
>> │   ├── migrations
>> │   │   ├── 0001_initial.py
>> │   │   └── __init__.py
>> │   ├── models.py
>> │   ├── tests.py
>> │   └── views.py
>> └── templates
>> └── admin
>> └── base_site.html
>>
>>
>>
>> mysite/settings.py:
>>
>> TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
>>
>>
>> *Whatever I do, the page*
>> *http://myserver:8000/admin/polls/question/ 
>> *
>> *still keeps the old title 'Django administration'*
>>
>>
>> I want to understand how templates work, because I need them for my real 
>> project.
>>
>> Thanks a lot!
>>
>>
>>

-- 
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/74b79ef9-b70a-4a1c-956e-9364378c12bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django server serving cached template pages

2015-03-10 Thread Collin Anderson
Hi,

Yes, apparently many people get tripped up on this step. Is this django1.7?

create a blank "blank_site.html".  <- I assume you mean create a blank 
base_site.html?

I assume this is with manage.py runserver? (If it's apache/uwsgi/gunicorn, 
you need to reload the program when changing the setting.)

Caching should only be an issue if the cached template loader is installed, 
which it isn't by default.

Collin

On Sunday, March 8, 2015 at 4:10:09 PM UTC-4, Bryan Arguello wrote:
>
> I am on the second page of the blog tutorial and am trying to change the 
> base-site.html template.  
>
> I make a few small changes, set the permissions to 755, put it in
> a subdirectory named 'admin' within a directory called 'template' inside 
> of the project directory.  
>
> I also add the template directory path to the TEMPLATE_DIRS variable
> in settings.py and restart the server.  
>
> After several hours of trying things suggested in different forums on this 
> topic, I decided to just rename the original base_site.html in 
> django/contrib/admin/templates/admin and create a blank "blank_site.html".  
>
> After doing this, one would expect to get a blank page if the templates in 
> TEMPLATE_DIRS were not found.  However, I am getting the same "Django 
> administration" page.  Also, I did go into the manage.py shell and check 
> TEMPLATE_DIRS: it is set to the correct directory.  I am starting to think 
> this is some kind of Django server cache issue (tried clearing browser 
> cache).
>
> I can see that many new-comers to Django have come across this issue and 
> none of the suggestions for these users seem to work.  However, I have 
> never seen anyone mention a cache being the issue.  Does anyone have any 
> suggestions?
>

-- 
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/1e222d27-64fc-44e3-909a-2668a7f3d1e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: fake button run a view and come back to the same page.

2015-03-10 Thread Daniel Roseman
On Tuesday, 10 March 2015 17:11:16 UTC, dk wrote:
>
> I been trying to find information on how to make a button to run a python 
> script in the back.
> I do have a table with some buttons,  and I want to click in one, and 
> behind doors, will run a python script.
>
> since I don't know to much javascript or flask, or php I decided to make a 
> link (later on I can make it look like a button)  that link will run the 
> view witch is my script as subprocess and then 
> return back again the view of my table,   
> so basicly will click the button, will run the code, and redo the view 
> that I was all ready in. something like this.
>
> views:
> def main_table(request):
> list_of_files= here I get my files.
> return render(request, "show_table", {"list":list_of_files})
> 
>
>
> def button_do_thing(request):
> file = request.GET.get(file_name)
> dosomething
>
> main_table(request) # here is where I am actually calling again to 
> the main table to redraw it on the browswer.
>
> but I get the error:
>
> The view mes.views.test_machine didn't return an HttpResponse object. It 
> returned None instead.
>
> I tought passing the request should do it?
>
>
> any tips, tricks?  or an actual way to make the button run the script?
>
> thanks guys =)   .
>
>

You didn't return anything at all from your do_thing view, hence the error.

However you shouldn't really call one view from the other. If you do that, 
the browser will show the URL of the main view, which will be confusing. 
Instead, after running the task, *redirect* back to the main view:

 from django.shortcuts import redirect
 ...
 return redirect('mes.views.main_table')

--
Daniel.

-- 
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/34119ebe-e2d2-4d16-afd3-bc003d218250%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to make responsinator.com working with Django?

2015-03-10 Thread James Schneider
Does the site load when accessing it from your own browser (or better yet,
from a different machine connected to the Internet)? Are you pasting in an
http://127.0.0.1:8000 address? If so, that won't work with tools like
responsinator.com. Your site will need to be publicly accessible on the
Internet before that service can work for you. If you are running the
Django development server (runserver), then your site is only available to
you on your local machine by default (unless you pass in extra options and
do other funny things with firewalls, etc.)

I use the Web Developer toolbar for Firefox. It includes the ability to
view your pages in multiple pane sizes to test responsiveness (pretty close
to how responsinator displays it), as well as many other useful tools. It
also works just dandy using the Django runserver, since I'm developing and
running the development server on the same machine where I'm doing my
initial responsive testing. Highly recommended.

-James


On Tue, Mar 10, 2015 at 8:32 AM, inoyon artlover KLANGRAUSCH <
inoyonartlo...@googlemail.com> wrote:

> Hi no. I did a responsive site with bootstrap. But when I enter the url in
> responinator,
> nothing happens. ..
>
> Am Dienstag, 10. März 2015 16:05:03 UTC+1 schrieb inoyon artlover
> KLANGRAUSCH:
>>
>> Hi there,
>>
>> how can I get Django working with responsinator.com ?
>>
>> Best regards! :)
>>
>  --
> 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/17638018-fbcd-459f-955b-07da7e38edeb%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/CA%2Be%2BciVxgBdT%3DigGK%2BjbBAcvCu8uecs%2BZuMvZc4b8yjh_0K3yQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: fake button run a view and come back to the same page.

2015-03-10 Thread dk
UHH redirect sounds  easy.. yami yami.

Felix  how does the ajax works? I am assuming is a library of javascripts? 
and ajax can lunch the python code?


On Tuesday, March 10, 2015 at 1:48:56 PM UTC-5, Daniel Roseman wrote:

> On Tuesday, 10 March 2015 17:11:16 UTC, dk wrote:
>>
>> I been trying to find information on how to make a button to run a python 
>> script in the back.
>> I do have a table with some buttons,  and I want to click in one, and 
>> behind doors, will run a python script.
>>
>> since I don't know to much javascript or flask, or php I decided to make 
>> a link (later on I can make it look like a button)  that link will run the 
>> view witch is my script as subprocess and then 
>> return back again the view of my table,   
>> so basicly will click the button, will run the code, and redo the view 
>> that I was all ready in. something like this.
>>
>> views:
>> def main_table(request):
>> list_of_files= here I get my files.
>> return render(request, "show_table", {"list":list_of_files})
>> 
>>
>>
>> def button_do_thing(request):
>> file = request.GET.get(file_name)
>> dosomething
>>
>> main_table(request) # here is where I am actually calling again to 
>> the main table to redraw it on the browswer.
>>
>> but I get the error:
>>
>> The view mes.views.test_machine didn't return an HttpResponse object. It 
>> returned None instead.
>>
>> I tought passing the request should do it?
>>
>>
>> any tips, tricks?  or an actual way to make the button run the script?
>>
>> thanks guys =)   .
>>
>>
>
> You didn't return anything at all from your do_thing view, hence the error.
>
> However you shouldn't really call one view from the other. If you do that, 
> the browser will show the URL of the main view, which will be confusing. 
> Instead, after running the task, *redirect* back to the main view:
>
>  from django.shortcuts import redirect
>  ...
>  return redirect('mes.views.main_table')
>
> --
> Daniel.
>

-- 
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/834b2249-ac4f-44fa-950f-1befee440a9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: fake button run a view and come back to the same page.

2015-03-10 Thread felix

El 10/03/15 15:46, dk escribió:

UHH redirect sounds  easy.. yami yami.

Felix  how does the ajax works? I am assuming is a library of 
javascripts? and ajax can lunch the python code?



ajax = Asynchronous Javascript And XML
It means you can update part of a page without reloading the entire page.
It is javascript in the client side. In the server side it could be any 
server side language/framework, including django.


Check the chapter about Ajax here. It might guide you
http://www.tangowithdjango.com/

Though if you want to use an MVC framework you could try AngularJS. Take 
a look at this tutorial:

http://www.w3schools.com/angular/default.asp


--
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/54FF5101.5020601%40epepm.cupet.cu.
For more options, visit https://groups.google.com/d/optout.


Re: How to track number of visitors on django site

2015-03-10 Thread Vijay Khemlani
Hmmm... what about the classic Google Analytics?

On Tue, Mar 10, 2015 at 5:04 PM, Andreas Kuhne 
wrote:

> Hi all,
>
> I would like to be able to track the number of visitors on our website. We
> previously had django-tracking installed and a munin node that tracked the
> information. Unfortunately we weren't able to continue using it because it
> broke our website somehow (I don't remember how).
>
> Does anyone have any ideas for how to create a similar functionality or a
> similar plugin that can be used?
>
> Regards,
>
> Andréas
>
> --
> 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/CALXYUbnm0zqK9hpH%2BOoSt9tYYeTDu2dGXXhgaE-%2BYiO-9n-LGw%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/CALn3ei10FoMMSTuqO_FdgEGFEEFXDFpiebZ_0hOVahiZs2aAfg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to track number of visitors on django site

2015-03-10 Thread Andreas Kuhne
Hi Vijay,

Thanks for the suggestion, and we are of course using GA (I should have
mentioned that). The problem is our CEO doesn't like the way GA compiles
the information and he also feels that it's too slow, he can't get the
views that he would like.

So we would like to add this information ourselves somehow.

Regards,

Andréas

2015-03-10 21:40 GMT+01:00 Vijay Khemlani :

> Hmmm... what about the classic Google Analytics?
>
> On Tue, Mar 10, 2015 at 5:04 PM, Andreas Kuhne  > wrote:
>
>> Hi all,
>>
>> I would like to be able to track the number of visitors on our website.
>> We previously had django-tracking installed and a munin node that tracked
>> the information. Unfortunately we weren't able to continue using it because
>> it broke our website somehow (I don't remember how).
>>
>> Does anyone have any ideas for how to create a similar functionality or a
>> similar plugin that can be used?
>>
>> Regards,
>>
>> Andréas
>>
>> --
>> 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/CALXYUbnm0zqK9hpH%2BOoSt9tYYeTDu2dGXXhgaE-%2BYiO-9n-LGw%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/CALn3ei10FoMMSTuqO_FdgEGFEEFXDFpiebZ_0hOVahiZs2aAfg%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/CALXYUbnmDac3NTzv8iDFoUx-nfFegPFZDTa5Up4N2hLF%2BpTniQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Using the eval() command

2015-03-10 Thread Henry Versemann
I have a new dictionary that I want to build, using data from another 
dictionary. I have a view which is receiving a single key/value pair 
from the original dictionary. Then in the view I've defined the new 
dictionary like this:

innerDict = {}  

Now I want to make this as dynamic as possible so I'm trying to use the 
"eval()" statement below to add the new key/value pair to the new 
dictionary, which is declared above. Will the following code work to 
actually add the new key/value pair to the new dictionary?

innrDictCmnd = "innerDict['"+newinnrkey+"'] = newinnrval"
eval(innrDictCmnd)

If not why not, and in lieu of the statements above not working, then how 
would I do it?

Thanks for the help.

Henry


-- 
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/e6c61ca1-efba-4965-a5ec-f10b55927b15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using the eval() command

2015-03-10 Thread Bill Freeman
eval() operates on an expression, not a statement.  Assignment makes it a
statement.

Why wouldn't you just say:

  innerDict['+newinnrkey+'] = newinnrval


On Tue, Mar 10, 2015 at 5:25 PM, Henry Versemann 
wrote:

> I have a new dictionary that I want to build, using data from another
> dictionary. I have a view which is receiving a single key/value pair
> from the original dictionary. Then in the view I've defined the new
> dictionary like this:
>
> innerDict = {}
>
> Now I want to make this as dynamic as possible so I'm trying to use the
> "eval()" statement below to add the new key/value pair to the new
> dictionary, which is declared above. Will the following code work to
> actually add the new key/value pair to the new dictionary?
>
> innrDictCmnd = "innerDict['"+newinnrkey+"'] = newinnrval"
> eval(innrDictCmnd)
>
> If not why not, and in lieu of the statements above not working, then how
> would I do it?
>
> Thanks for the help.
>
> Henry
>
>
>  --
> 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/e6c61ca1-efba-4965-a5ec-f10b55927b15%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/CAB%2BAj0v6ZY-d2z7QOrg9XnKb11kWoR6uBov_9ehohAAF5v7nYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


First time user, can't start project!

2015-03-10 Thread ephoneemail
Hi!

I ran the command to get my version and it worked. However when I run:
django-admin.py startproject mysite

It does not create the mysite directory... any help?

Thank you!

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


Filtering a QuerySet by the result of user.has_perm

2015-03-10 Thread Adam Gamble
Hi all,

I'm stuck on how to restructure the following in order to return a QuerySet 
instead of a List (needed for Lazy evaluation):

filter(lambda o: user.has_perm('read', o), MyModel.objects.all())

Using django-guardian , for 
object-level permissions.

Appreciate any ideas,

Adam

-- 
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/db04945f-d6c2-42a7-88fa-2f0c7c3bc284%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using the eval() command

2015-03-10 Thread Carl Meyer
Hi Henry,

On 03/10/2015 03:25 PM, Henry Versemann wrote:
> I have a new dictionary that I want to build, using data from another
> dictionary. I have a view which is receiving a single key/value pair
> from the original dictionary. Then in the view I've defined the new
> dictionary like this:
> 
> innerDict = {}  
> 
> Now I want to make this as dynamic as possible so I'm trying to use the
> "eval()" statement below to add the new key/value pair to the new
> dictionary, which is declared above. Will the following code work to
> actually add the new key/value pair to the new dictionary?
> 
> innrDictCmnd = "innerDict['"+newinnrkey+"'] = newinnrval"
> eval(innrDictCmnd)
> 
> If not why not, and in lieu of the statements above not working, then
> how would I do it?

It doesn't work, because eval() only accepts expressions; assignment is
a statement. Using exec() instead of eval() will work (though the way
you have it written, it will always assign the string "newinnrval" --
perhaps you meant to end innrDictCmnd with '... = ' + newinnrval).

But regardless, you should not use either eval() or exec().

Since you say this code is in a view, I assume that newinnrkey comes
from request data (user input). Imagine what happens if I am a malicious
user and I call this view with newinnrkey set to:

'] = 0; import os; os.rm('/'); d = {}; d['

Oops.

Both exec() and eval() should be avoided. They are very rarely
necessary, they usually make code less readable and maintainable, and if
you ever accidentally pass user input to them, you've opened up a
security hole in your application that someone could drive a truck through.

For your case, what's wrong with just writing `innerDict[newinnerkey] =
newinnerval`? It's every bit as dynamic as the version using eval or
exec - the eval/exec gains you nothing.

Carl


-- 
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/54FF66E3.5050408%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: First time user, can't start project!

2015-03-10 Thread Andrew Farrell
What platform are you on?
Does it print out anything?
What does running the command `dir` show before and after running
`django-admin.py startproject mysite` ?

On Tue, Mar 10, 2015 at 12:09 PM,  wrote:

> Hi!
>
> I ran the command to get my version and it worked. However when I run:
> django-admin.py startproject mysite
>
> It does not create the mysite directory... any help?
>
> Thank you!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/dbfbe507-8961-4aab-a659-cc997c6a4673%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/CA%2By5TLYGweDfH7xR9moNgCqEbtfsVTV%3D_spDR_znvKGRCgN%3DVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.6's lifespan for security updates?

2015-03-10 Thread Carl Meyer
Hi Christian,

On 03/10/2015 01:44 PM, Christian Hammond wrote:
> According to
> https://docs.djangoproject.com/en/1.7/internals/release-process/#supported-versions,
> it appears that when Django 1.8 is released, Django 1.6 will no longer
> receive security updates. I wanted to verify that this is true, and ask
> whether there's a possibility of an extension on this timeframe.

It is true, and I don't think it should be extended.

> I'll explain the situation we're in.
> 
> I manage Review Board, a code review tool currently in use by several
> thousand companies/organizations, many of whom (according to stats we
> have available) are on Python 2.6. From conversations we've had, many of
> these companies are on LTS releases of Linux distributions that bundle
> Python 2.6 by default (including their mod_wsgi support, etc.), and are
> likely to remain on it for the next year or two. Not to mention Amazon
> Linux and other variants are all sticking with 2.6 for now as well.
> 
> This puts us in a difficult position where we are unable to drop Python
> 2.6 support without affecting a large number of installs out there (12%
> of our base, or over 700 installs), meaning we haven't yet been able to
> make the transition to Django 1.7/1.8 (as much as we want it). (It also
> makes the lives of packagers easier who are trying to support software
> stuck in this situation, from what I'm being told, as they're
> responsible for security updates.)
> 
> As Django 1.6 is the last release to support Python 2.6, it would be
> very nice to have a longer-term security release plan while companies
> transition over. We see this happening, but slowly.
> 
> Is there any possibility of treating Django 1.6 as a special LTS release?

I sympathize with your situation, but Python 2.6 reached end-of-life on
October 29, 2013 (a year and a half ago now), and since then has been
unsupported and not receiving security updates. I don't think the Django
core team should set a precedent of extended support for Python versions
which are themselves unsupported by the core Python developers.

If some Linux distributions are backporting Python security patches to
2.6 themselves in order to extend its lifetime in their distribution,
perhaps it would make sense to ask them whether they will also backport
Django security patches to Django 1.6. (I would guess that some of them
may already be planning to do so, and may even have already done so for
previous Django releases in the past.)

Carl

-- 
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/54FF6991.7080909%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: How to get/assign the contents of the app code directory into my Django project

2015-03-10 Thread Gergely Polonkai
Hello,

this pretty much depends on your environment. I, personally, use virtualenv
and pip, so most likely will install such an external app like this:

pip install git://my.favourite.provider/awesome/app.git

If you use your system python, with a system-wide installed django, then
you may either want to install this new app into a system-wide python
directory, or simply inject it into your application's structure (which, in
turn, may mess up your version control system, if you use any; and you
should).

Best,
Gergely
On 10 Mar 2015 22:47, "jaisol"  wrote:

> Hi,
>
> Sorry to ask such a silly question I just cloned a Django app via git
> and I want to get the contents of the app code directory into my Django
> project.
>
> The Readme.md says the following but I don't get it :-(
>
> Folder Structure
>
> You will need to get the contents of the src/idea directory into your
> Django project. The simplest way to do this might be a symbolic link.
>
> mydjango_project/
>   |- idea/  (includes models.py, views.py, etc.)
>   |- mydjango_project/ (settings.py, url.py, etc.)
>   |- manage.py
>   |- etc etc etc
>
> Any advice or guidance would be greatly appreciated !!
>
> 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/b5f3a14a-a487-4459-843f-ca7d560beff9%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/CACczBU%2B5SRKRncZmQfh7gapjXeQOVwc_-kjt8ro_ZAzOcxiD7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to track number of visitors on django site

2015-03-10 Thread luis zarate
I know django-statistics ( https://github.com/attuch/django-statistics )
but I have never used

2015-03-10 15:16 GMT-06:00 Andreas Kuhne :

> Hi Vijay,
>
> Thanks for the suggestion, and we are of course using GA (I should have
> mentioned that). The problem is our CEO doesn't like the way GA compiles
> the information and he also feels that it's too slow, he can't get the
> views that he would like.
>
> So we would like to add this information ourselves somehow.
>
> Regards,
>
> Andréas
>
> 2015-03-10 21:40 GMT+01:00 Vijay Khemlani :
>
>> Hmmm... what about the classic Google Analytics?
>>
>> On Tue, Mar 10, 2015 at 5:04 PM, Andreas Kuhne <
>> andreas.ku...@suitopia.com> wrote:
>>
>>> Hi all,
>>>
>>> I would like to be able to track the number of visitors on our website.
>>> We previously had django-tracking installed and a munin node that tracked
>>> the information. Unfortunately we weren't able to continue using it because
>>> it broke our website somehow (I don't remember how).
>>>
>>> Does anyone have any ideas for how to create a similar functionality or
>>> a similar plugin that can be used?
>>>
>>> Regards,
>>>
>>> Andréas
>>>
>>> --
>>> 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/CALXYUbnm0zqK9hpH%2BOoSt9tYYeTDu2dGXXhgaE-%2BYiO-9n-LGw%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/CALn3ei10FoMMSTuqO_FdgEGFEEFXDFpiebZ_0hOVahiZs2aAfg%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/CALXYUbnmDac3NTzv8iDFoUx-nfFegPFZDTa5Up4N2hLF%2BpTniQ%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



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


Re: Django 1.6's lifespan for security updates?

2015-03-10 Thread Avraham Serour
each django deployed on the machines with python 2.6 should already be on
the project virtualenv
I suggest to compile python 2.7 yourself and create  the virtualenvs based
on the compiled python, no need to replace it system-wide

On Wed, Mar 11, 2015 at 12:00 AM, Carl Meyer  wrote:

> Hi Christian,
>
> On 03/10/2015 01:44 PM, Christian Hammond wrote:
> > According to
> >
> https://docs.djangoproject.com/en/1.7/internals/release-process/#supported-versions
> ,
> > it appears that when Django 1.8 is released, Django 1.6 will no longer
> > receive security updates. I wanted to verify that this is true, and ask
> > whether there's a possibility of an extension on this timeframe.
>
> It is true, and I don't think it should be extended.
>
> > I'll explain the situation we're in.
> >
> > I manage Review Board, a code review tool currently in use by several
> > thousand companies/organizations, many of whom (according to stats we
> > have available) are on Python 2.6. From conversations we've had, many of
> > these companies are on LTS releases of Linux distributions that bundle
> > Python 2.6 by default (including their mod_wsgi support, etc.), and are
> > likely to remain on it for the next year or two. Not to mention Amazon
> > Linux and other variants are all sticking with 2.6 for now as well.
> >
> > This puts us in a difficult position where we are unable to drop Python
> > 2.6 support without affecting a large number of installs out there (12%
> > of our base, or over 700 installs), meaning we haven't yet been able to
> > make the transition to Django 1.7/1.8 (as much as we want it). (It also
> > makes the lives of packagers easier who are trying to support software
> > stuck in this situation, from what I'm being told, as they're
> > responsible for security updates.)
> >
> > As Django 1.6 is the last release to support Python 2.6, it would be
> > very nice to have a longer-term security release plan while companies
> > transition over. We see this happening, but slowly.
> >
> > Is there any possibility of treating Django 1.6 as a special LTS release?
>
> I sympathize with your situation, but Python 2.6 reached end-of-life on
> October 29, 2013 (a year and a half ago now), and since then has been
> unsupported and not receiving security updates. I don't think the Django
> core team should set a precedent of extended support for Python versions
> which are themselves unsupported by the core Python developers.
>
> If some Linux distributions are backporting Python security patches to
> 2.6 themselves in order to extend its lifetime in their distribution,
> perhaps it would make sense to ask them whether they will also backport
> Django security patches to Django 1.6. (I would guess that some of them
> may already be planning to do so, and may even have already done so for
> previous Django releases in the past.)
>
> Carl
>
> --
> 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/54FF6991.7080909%40oddbird.net
> .
> 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/CAFWa6tLZTMxnLfg0m-Uxpr9S%2Bh%3DKDTWf%2BUSMYawa%2BcBUm7%2BypA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get/assign the contents of the app code directory into my Django project

2015-03-10 Thread jaisol
Thanks for your quick response.

Ok. I'm using my system python with a system-wide installed django.

I ran git clone:
git clone https://github.com/provider/app.git and it created the folder 
structure of the django app I think.

what I don't get is how to complete your advice ("or simply inject it into 
your application's structure") within the downloaded app.
I mean, after downloading the app via git clone... should I create/edit 
some configuration file to get the contents of the "src/idea" app directory 
into my django project? and how? :-(

Thanks again!


On Tuesday, March 10, 2015 at 4:03:55 PM UTC-6, Gergely Polonkai wrote:
>
> Hello,
>
> this pretty much depends on your environment. I, personally, use 
> virtualenv and pip, so most likely will install such an external app like 
> this:
>
> pip install git://my.favourite.provider/awesome/app.git
>
> If you use your system python, with a system-wide installed django, then 
> you may either want to install this new app into a system-wide python 
> directory, or simply inject it into your application's structure (which, in 
> turn, may mess up your version control system, if you use any; and you 
> should).
>
> Best,
> Gergely
> On 10 Mar 2015 22:47, "jaisol" > wrote:
>
>> Hi,
>>
>> Sorry to ask such a silly question I just cloned a Django app via git 
>> and I want to get the contents of the app code directory into my Django 
>> project.
>>
>> The Readme.md says the following but I don't get it :-(
>>
>> Folder Structure
>>
>> You will need to get the contents of the src/idea directory into your 
>> Django project. The simplest way to do this might be a symbolic link.
>>
>> mydjango_project/
>>   |- idea/  (includes models.py, views.py, etc.)
>>   |- mydjango_project/ (settings.py, url.py, etc.)
>>   |- manage.py
>>   |- etc etc etc
>>
>> Any advice or guidance would be greatly appreciated !!
>>
>> 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/b5f3a14a-a487-4459-843f-ca7d560beff9%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/7c4520d1-d6ce-4905-bb32-284e18bfc382%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: GSoKites Virtual Classroom

2015-03-10 Thread Russell Keith-Magee
Hi Barclay,

Welcome to the community! If you want to know anything about the Django
Project's involvement in Google Summer of Code, our wiki page is here:

https://code.djangoproject.com/wiki/SummerOfCode2015

If you've got any more questions, let us know.

Yours,
Russ Magee %-)

On Tue, Mar 10, 2015 at 2:32 PM, Barclay Koin  wrote:

> *Hi am Barclay from Nairobi Kenya currently a student at Dedan kimathi
> University of Technology. Am applying for  GSoKites Virtual Classroom
> and would like to a part of the growing community.*
>
> --
> 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/a166e492-fe8a-4aff-aa24-01c778d4f10c%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/CAJxq84_HHv8daJEYrf%2B44KFSCLJ0iYawu9Q4fPqna_USR2dU4A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to track number of visitors on django site

2015-03-10 Thread Nathan Clayton
On 3/10/2015 2:16 PM, Andreas Kuhne wrote:
> Hi Vijay,
> 
> Thanks for the suggestion, and we are of course using GA (I should have
> mentioned that). The problem is our CEO doesn't like the way GA compiles
> the information and he also feels that it's too slow, he can't get the
> views that he would like. 
> 
> So we would like to add this information ourselves somehow.
> 
> Regards,
> 
> Andréas
> 
> 2015-03-10 21:40 GMT+01:00 Vijay Khemlani  >:
> 
> Hmmm... what about the classic Google Analytics?
> 
> On Tue, Mar 10, 2015 at 5:04 PM, Andreas Kuhne
> mailto:andreas.ku...@suitopia.com>> wrote:
> 
> Hi all,
> 
> I would like to be able to track the number of visitors on our
> website. We previously had django-tracking installed and a munin
> node that tracked the information. Unfortunately we weren't able
> to continue using it because it broke our website somehow (I
> don't remember how). 
> 
> Does anyone have any ideas for how to create a similar
> functionality or a similar plugin that can be used?
> 
> Regards,
> 
> Andréas

Provided you're OK with a MySQL installation, you can always install
Piwik (http://piwik.org). Then you'd have direct access to the database
for reporting / analysis in realtime.

-- 
Nathan Clayton
nathanclay...@gmail.com

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


[django 1.7.6] system error: 10054 An existing connection was forcibly closed by the remote host

2015-03-10 Thread Weifeng Pan
Hi,


I upgrade to latest version of django.  Every time I navigate to django 
admin site "User" page.  I got this error:

File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\core\handlers\base.py", 
line 111, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\contrib\admin\options.py", 
line 583, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\utils\decorators.py", 
line 105, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\views\decorators\cache.py", 
line 52, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\contrib\admin\sites.py", 
line 206, in inner
return view(request, *args, **kwargs)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\utils\decorators.py", 
line 29, in _wrapper
return bound_func(*args, **kwargs)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\utils\decorators.py", 
line 105, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\utils\decorators.py", 
line 25, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\contrib\admin\options.py", 
line 1485, in changelist_view
self.list_max_show_all, self.list_editable, self)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\contrib\admin\views\main.py",
 
line 109, in __init__
self.queryset = self.get_queryset(request)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\contrib\admin\views\main.py",
 
line 359, in get_queryset
filters_use_distinct) = self.get_filters(request)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\contrib\admin\views\main.py",
 
line 175, in get_filters
self.model, self.model_admin, field_path=field_path)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\contrib\admin\filters.py", 
line 158, in create
model, model_admin, field_path=field_path)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\contrib\admin\filters.py", 
line 172, in __init__
self.lookup_choices = field.get_choices(include_blank=False)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\db\models\fields\__init__.py",
 
line 750, in get_choices
self.get_limit_choices_to())]
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\db\models\query.py", 
line 141, in __iter__
self._fetch_all()
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\db\models\query.py", 
line 966, in _fetch_all
self._result_cache = list(self.iterator())
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\db\models\query.py", 
line 265, in iterator
for row in compiler.results_iter():
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\db\models\sql\compiler.py", 
line 700, in results_iter
for rows in self.execute_sql(MULTI):
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\db\models\sql\compiler.py", 
line 786, in execute_sql
cursor.execute(sql, params)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\db\backends\utils.py", 
line 81, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\django\db\backends\utils.py", 
line 65, in execute
return self.cursor.execute(sql, params)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\mysql\connector\django\base.py", 
line 135, in execute
return self._execute_wrapper(self.cursor.execute, query, args)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\mysql\connector\django\base.py", 
line 124, in _execute_wrapper
utils.DatabaseError(err.msg), sys.exc_info()[2])
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\mysql\connector\django\base.py", 
line 115, in _execute_wrapper
return method(query, args)
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\mysql\connector\cursor.py", 
line 507, in execute
self._handle_result(self._connection.cmd_query(stmt))
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\mysql\connector\connection.py", 
line 722, in cmd_query
result = self._handle_result(self._send_cmd(ServerCmd.QUERY, query))
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\mysql\connector\connection.py", 
line 510, in _send_cmd
return self._socket.recv()
  File 
"C:\MyProjects\WuWuKe\venv\lib\site-packages\mysql\connector\network.py", 
line 253, in recv_plain
errno=2055, values=(self.get_address(), _strioerror(err)))
DatabaseError: Lost connection to MySQL server at '.', system 
error: 10054 An existing connection was forcibly closed by the remote host


I debug the code:
I found  every time executing this sql 'SELECT `auth_grou

Re: Generic Relation in Legacy Database?

2015-03-10 Thread ringemup

Thanks, Gergely — it’s actually Eloquent, which handles GFKs a little more 
similarly to Django than Doctrine does, AFAICT.

Would you mind sharing your GFK changes-in-progress?  Maybe we could 
collaborate on a broader solution.


On Mar 10, 2015, at 3:30 PM, Gergely Polonkai  wrote:

> Hello,
> 
> By taking a quick glance on I'm afraid that a GFK subclass is your best bet. 
> I was experimenting with a Doctrine DB (based on your description my guess 
> was that your old ORM may be that). A little bit of change to GFK made the 
> query working, although I haven't solved the insert/update problem yet.
> 
> Best,
> Gergely
> 
> On 10 Mar 2015 15:57,  wrote:
> 
> Avraham, are you at all familiar with Django’s GenericForeignKey model field? 
>  
> 
> It relies on *two* fields in the model.  Django resolves a generic foreign 
> key by looking up the content type (a FK to the content types table) to 
> figure out what table to look for the object ID in.  Then it looks for the 
> object ID (what would normally be the foreign key) in the table in question.
> 
> The problem is not the object ID.  The problem is that my table does not 
> reference Django’s content types table and thus does not conform to what 
> Django expects from a GenericForeignKey.  Django then won’t be able to tell 
> which table to look up the object ID in.
> 
> And I’m using Postgres, but that shouldn’t matter in this case.
> 
> 
> On Mar 10, 2015, at 10:47 AM, Avraham Serour  wrote:
> 
>> for each field in the model you can specify the column name un the db, it 
>> does have a default way of calculating that, but you can specify
>> 
>> in any case you can tell the django ORM that this field is not an int, it is 
>> actually a foreign key, let me know if that works
>> 
>> what DB are you using? mysql?
>> 
>> On Tue, Mar 10, 2015 at 2:59 PM, Nan  wrote:
>> 
>> Thanks, Avraham -- I was planning to use inspectdb as a first step, and it's 
>> very handy in streamlining building models!
>> 
>> But that doesn't even begin to solve the problem of how a GFK modeled 
>> differently than Django's ORM does can be used as an actual foreign key.
>> 
>> 
>> On Sunday, March 8, 2015 at 1:07:56 PM UTC-4, Avraham Serour wrote:
>> use inspectdb to start
>> 
>> On Sun, Mar 8, 2015 at 5:31 PM, Nan  wrote:
>> 
>> Hi folks --
>> 
>> I'm building out Django models to represent a legacy PHP app's database in 
>> order to throw together a quick admin panel.  Everything's working great 
>> except that the ORM of the other application represents generic relations 
>> slightly differently than Django's does.  I can't modify the DB schema 
>> because the legacy application has to continue to run.
>> 
>> Django uses:
>> 
>> int content_type_id
>> int object_id
>> 
>> The existing DB essentially uses:
>> 
>> string model_class_name
>> int object_id
>> 
>> Is there a way to get Django's ORM to use these fields to represent a GFK 
>> relationship so I can use it in the admin?  I can add tables, just not 
>> modify existing ones.  Maybe an extra 1-to-1 mapping content types to legacy 
>> model names would help?  Maybe writing a GenericForeignKey subclass?  A 
>> quick look at the source suggests there are a lot of methods that will need 
>> to be overridden (by copy-pasting 40 lines and changing one), which doesn't 
>> sound like fun to maintain in the long run.
>> 
>> Just wondering if anyone's done this before or has any tips before I dive in.
>> 
>> 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/3ec838f1-34ff-46f1-9b94-d3b9ac905d19%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/65c6f173-b407-465c-aecf-0c0a018050c6%40googlegroups.com.
>> 
>> For more options, visit https://groups.google.com/d/optout.
>> 
>> 
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/django-users/CRGUNH0DkhU/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> django-users+unsubscr...

Re: Using the eval() command

2015-03-10 Thread Henry Versemann
so its valid python code to write the expression

innerDict['+newinnrkey+'] 

without enclosing the parts outside of the plus-signs surrounding the 
"newinnrkey" variable within quotes or double quotes?
I'm not sure I've ever heard or seen such python code before anywhere.
Can you explain or point me to some docs on this type of code expression?
And are there any gotchas or problems coding expressions like this?
Thanks for the help.

Henry 
 

On Tuesday, March 10, 2015 at 4:34:34 PM UTC-5, ke1g wrote:

> eval() operates on an expression, not a statement.  Assignment makes it a 
> statement.
>
> Why wouldn't you just say:
>
>   innerDict['+newinnrkey+'] = newinnrval
>
>
> On Tue, Mar 10, 2015 at 5:25 PM, Henry Versemann  > wrote:
>
>> I have a new dictionary that I want to build, using data from another 
>> dictionary. I have a view which is receiving a single key/value pair 
>> from the original dictionary. Then in the view I've defined the new 
>> dictionary like this:
>>
>> innerDict = {}  
>>
>> Now I want to make this as dynamic as possible so I'm trying to use the 
>> "eval()" statement below to add the new key/value pair to the new 
>> dictionary, which is declared above. Will the following code work to 
>> actually add the new key/value pair to the new dictionary?
>>
>> innrDictCmnd = "innerDict['"+newinnrkey+"'] = newinnrval"
>> eval(innrDictCmnd)
>>
>> If not why not, and in lieu of the statements above not working, then how 
>> would I do it?
>>
>> Thanks for the help.
>>
>> Henry
>>
>>
>>  -- 
>> 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/e6c61ca1-efba-4965-a5ec-f10b55927b15%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/a6113acb-e437-42c6-88d9-f19476905dbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using the eval() command

2015-03-10 Thread Henry Versemann
So how does an expression like you suggested above ( 
innerDict['+newinnrkey+'] = newinnrval ) work then?
It seems like it wouldn't work without enclosing the expression with quotes 
or double-quotes, and even then it seems like it would only become some 
kind of string instead of a statement which would be automatically executed 
to produce a result. Please explain or point me to some 
documentation explaining this type of code or coding.
Thanks.

Henry

On Tuesday, March 10, 2015 at 4:49:48 PM UTC-5, Carl Meyer wrote:

> Hi Henry, 
>
> On 03/10/2015 03:25 PM, Henry Versemann wrote: 
> > I have a new dictionary that I want to build, using data from another 
> > dictionary. I have a view which is receiving a single key/value pair 
> > from the original dictionary. Then in the view I've defined the new 
> > dictionary like this: 
> > 
> > innerDict = {}   
> > 
> > Now I want to make this as dynamic as possible so I'm trying to use the 
> > "eval()" statement below to add the new key/value pair to the new 
> > dictionary, which is declared above. Will the following code work to 
> > actually add the new key/value pair to the new dictionary? 
> > 
> > innrDictCmnd = "innerDict['"+newinnrkey+"'] = newinnrval" 
> > eval(innrDictCmnd) 
> > 
> > If not why not, and in lieu of the statements above not working, then 
> > how would I do it? 
>
> It doesn't work, because eval() only accepts expressions; assignment is 
> a statement. Using exec() instead of eval() will work (though the way 
> you have it written, it will always assign the string "newinnrval" -- 
> perhaps you meant to end innrDictCmnd with '... = ' + newinnrval). 
>
> But regardless, you should not use either eval() or exec(). 
>
> Since you say this code is in a view, I assume that newinnrkey comes 
> from request data (user input). Imagine what happens if I am a malicious 
> user and I call this view with newinnrkey set to: 
>
> '] = 0; import os; os.rm('/'); d = {}; d[' 
>
> Oops. 
>
> Both exec() and eval() should be avoided. They are very rarely 
> necessary, they usually make code less readable and maintainable, and if 
> you ever accidentally pass user input to them, you've opened up a 
> security hole in your application that someone could drive a truck 
> through. 
>
> For your case, what's wrong with just writing `innerDict[newinnerkey] = 
> newinnerval`? It's every bit as dynamic as the version using eval or 
> exec - the eval/exec gains you nothing. 
>
> Carl 
>
>
>

-- 
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/36ef505c-9957-4b68-964e-b8861e7fec14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django 1.8 ImportError: No module named formtools

2015-03-10 Thread Neto
I'm trying to use form wizard but when I put 'django.contrib.formtools', in 
INSTALLED_APPS appear on my terminal 'ImportError: No module named 
formtools'

-- 
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/4e7d04cc-1ea4-488d-9359-ffaf07123231%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django OperationalError

2015-03-10 Thread Petar Pilipovic
Hey Collin,
I have done what have you told me, but I still have that error, I even
created data base on www.pythonanywhere.com, and amend mine setting.py file
to use that db.
I have manually deleted database and done syncdb, migrate etc.
Here are the output for syncdb , and then I have made
mine superuser, this is the Operational Error .
Question: Why is he reporting this template rendering error on line 40?

Tank you
Best
Petar

On Tue, Mar 10, 2015 at 6:49 PM, Petar Pilipovic  wrote:

> Heh, lol, Ok tax Collin I will do that. I was thinking that i need to
> delete mine migration from the terminal, but I will try that, tnx
> 10.03.2015. 18.01, "Collin Anderson"  је написао/ла:
>
> Hi Petar,
>>
>> I'm actually not sure why you want to call sqlflush. If you're trying to
>> clear out the database, you may need to delete the migrations table
>> manually, but it just might be simpler to delete the either database and
>> re-create it, rather than the individual tables.
>>
>> Collin
>>
>> On Friday, March 6, 2015 at 11:24:19 PM UTC-5, Petar Pilipovic wrote:
>>>
>>> Hello Collin,
>>> No the problem is, i have tried to drop mine migrations whit python
>>> manage sqlflush, then I have recreate the db whit
>>> python manage.py migrate.
>>> Here this is the all operation whit python manage sqlflush, syncdb,
>>> migrate . I have notice that there was no
>>> migration to apply at the end, and the error is still there.
>>> Is there something else I can do, or how can I approach this differently.
>>> Best
>>> Petar
>>>
>>> On Fri, Mar 6, 2015 at 11:21 PM, Collin Anderson 
>>> wrote:
>>>
 Hi,

 The problem is that django_session doesn't exist in your database.
 Either it was never created or it was created and then later deleted.

 Does running manage.py migrate re-create it?

 Collin

 On Monday, March 2, 2015 at 11:36:51 PM UTC-5, Petar Pilipovic wrote:
>
> Hello James, sorry for not uploading mine answer on this mater, I was
> busy whit something else this day, ok now back to mine Operational Error I
> have got.
> I tried to google some solution to this problem had no luck, and I did
> what have you told me.
> I heave done some
> python manage.py sqlflush
>
> and that has gave me this output:
>
> (django17)04:20 ~/mineDjango$ python manage.py sqlflush BEGIN;DELETE
> FROM "django_admin_log";DELETE FROM "auth_permission";DELETE FROM
> "auth_group";DELETE FROM "auth_group_permissions";DELETE FROM
> "django_session";DELETE FROM "auth_user_groups";DELETE FROM
> "auth_user_user_permissions";DELETE FROM "account_emailaddress";DELETE
> FROM "django_site";DELETE FROM "profiles_profile";DELETE FROM
> "auth_user";DELETE FROM "profiles_userstripe";DELETE FROM
> "account_emailconfirmation";DELETE FROM "django_content_type";COMMIT;
>
> Then I have done
> python manage.py syncdb python manage.py migrate
>
> Output of mine recreating tables are this:
> (django17)04:20 ~/mineDjango$ python manage.py syncdbOperations to
> perform: Synchronize unmigrated apps: allauth, crispy_forms Apply all
> migrations: account, sessions, admin, sites, profiles, contenttypes,
> authSynchronizing apps without migrations: Creating tables...
> Installing custom SQL... Installing indexes...Running migrations: No
> migrations to apply.(django17)04:20 ~/mineDjango$ python manage.py
> migrateOperations to perform: Synchronize unmigrated apps: allauth,
> crispy_forms Apply all migrations: account, sessions, admin, sites,
> profiles, contenttypes, authSynchronizing apps without migrations:
> Creating tables... Installing custom SQL... Installing indexes...Running
> migrations: No migrations to apply.
> Basically I have had no changes in mine attempt to drop and recreate
> tables in mine application.
> The error is still there.
> Error:
> Environment:
>
>
>
>
> Request Method: GET
> Request URL: http://copser.pythonanywhere.com/
>
>
> Django Version: 1.7.2
> Python Version: 2.7.6
> Installed Applications:
> ('django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'profiles',
>  'crispy_forms',
>  'django.contrib.sites',
>  'allauth',
>  'allauth.account',
>  'stripe')
> Installed Middleware:
> ('django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django

Re: Django 1.8 ImportError: No module named formtools

2015-03-10 Thread Simon Charette
Hi Neto,

Here's an excerpt from the Django 1.8 release note 

:

The formtools contrib app has been moved into a separate package. 
> *django.contrib.formtools* itself has been removed. The docs provide 
> migration 
> instructions 
> 
> .
>
> The new package is available on Github 
>  and on PyPI.
>

TLDR; pip install django-formtools and replace all your references to 
*django.contrib.formtools* to *formtools*.

Simon

Le mercredi 11 mars 2015 00:33:29 UTC-4, Neto a écrit :
>
> I'm trying to use form wizard but when I put 'django.contrib.formtools', in 
> INSTALLED_APPS appear on my terminal 'ImportError: No module named 
> formtools'
>

-- 
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/1388cafa-0b66-4da8-be42-33714d1e7596%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get/assign the contents of the app code directory into my Django project

2015-03-10 Thread Gergely Polonkai
Hello,

as you didn't say which module you downloaded from GitHub, I cannot give
you exact information. Most Python modules have a ”setup” system, which
will copy all installable components to their place. If you can't (or don't
want to) install a module, you have to copy these files manually.

>From your question I guess that this module has all its files under
appname/src, so I think it will be enough to copy the src folder next to
your app directory, with a sane name (e.g. extmodule). After this step, you
can use extmodule as if it were your own app, like inserting it into
INSTALLED_APPS, etc.

However, the way you want to do it can really mess up things, especially
when a new version of this app gets released. You should install (and I
mean install, not just copy) the app system-wide, or into your own home
directory (and in this case add the location to PYTHONPATH). I personally
suggest to use virtualenv, which makes this above process a child's play :)

Best,
Gergely
On 11 Mar 2015 00:09, "jaisol"  wrote:

> Thanks for your quick response.
>
> Ok. I'm using my system python with a system-wide installed django.
>
> I ran git clone:
> git clone https://github.com/provider/app.git and it created the folder
> structure of the django app I think.
>
> what I don't get is how to complete your advice ("or simply inject it into
> your application's structure") within the downloaded app.
> I mean, after downloading the app via git clone... should I create/edit
> some configuration file to get the contents of the "src/idea" app directory
> into my django project? and how? :-(
>
> Thanks again!
>
>
> On Tuesday, March 10, 2015 at 4:03:55 PM UTC-6, Gergely Polonkai wrote:
>>
>> Hello,
>>
>> this pretty much depends on your environment. I, personally, use
>> virtualenv and pip, so most likely will install such an external app like
>> this:
>>
>> pip install git://my.favourite.provider/awesome/app.git
>>
>> If you use your system python, with a system-wide installed django, then
>> you may either want to install this new app into a system-wide python
>> directory, or simply inject it into your application's structure (which, in
>> turn, may mess up your version control system, if you use any; and you
>> should).
>>
>> Best,
>> Gergely
>> On 10 Mar 2015 22:47, "jaisol"  wrote:
>>
>>> Hi,
>>>
>>> Sorry to ask such a silly question I just cloned a Django app via
>>> git and I want to get the contents of the app code directory into my Django
>>> project.
>>>
>>> The Readme.md says the following but I don't get it :-(
>>>
>>> Folder Structure
>>>
>>> You will need to get the contents of the src/idea directory into your
>>> Django project. The simplest way to do this might be a symbolic link.
>>>
>>> mydjango_project/
>>>   |- idea/  (includes models.py, views.py, etc.)
>>>   |- mydjango_project/ (settings.py, url.py, etc.)
>>>   |- manage.py
>>>   |- etc etc etc
>>>
>>> Any advice or guidance would be greatly appreciated !!
>>>
>>> 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 http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/b5f3a14a-a487-4459-843f-ca7d560beff9%
>>> 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/7c4520d1-d6ce-4905-bb32-284e18bfc382%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/CACczBUJaJgt0xk%3D4DJ4smLX7uOorhU7bM7ZrN9aW7SEJmaigXw%40mail.gmail.com.
For