Re: Unable to reverse URL

2015-07-14 Thread James Schneider
That particular syntax works in Django 1.4, did you do an upgrade?

-James
On Jul 13, 2015 11:52 PM, "Vincent"  wrote:

> Hi James,
>
> substance_list is indeed the name of the view. I've now applied
> namespaces, and added quotes around each URL statement, and it works!
> thanks!
>
> What I do not understand is how it could have worked in the past.
>
> Regards,
> Vincent
>
> On Monday, July 13, 2015 at 6:36:00 PM UTC+2, James Schneider wrote:
>>
>> What is the value being given to substance_list in your template context?
>> It looks like it may be empty.
>>
>> Unless 'substance_list' is the actual name of the view? In which case you
>> probably need to add quotes around it in your URL tag:
>>
>> {% url 'substance_list' %}
>>
>> As is it is, the template is reading substance_list as a variable. If it
>> is the name, and not a variable, I would suggest looking into Django URL
>> name spaces, which are much easier to diagnose and maintain, and avoid the
>> missing quote issue since there can never be a variable name containing the
>> : character. For example,
>>
>> {% url 'substance:list' %}
>>
>> Is much less vague than 'substance_list' since the : version wouldn't
>> also work as a variable name, making it easier to figure out that you want
>> the name of a URL and not a variable name.
>>
>> https://docs.djangoproject.com/en/1.8/topics/http/urls/#url-namespaces
>>
>> -James
>> On Jul 13, 2015 7:27 AM, "Vincent"  wrote:
>>
>>> Hi everyone,
>>>
>>> I've started working on an application after some trime, but I can not
>>> get it to run again.
>>>
>>> I've got this error:
>>>
>>>   Reverse for '' with arguments '()' and keyword arguments '{}' not
>>> found. 0 pattern(s) tried: []
>>> Internal Server Error: /substances/
>>> Traceback (most recent call last):
>>>   File "C:\Python27\lib\site-packages\django\core\handlers\base.py",
>>> line 164, in get_response
>>> response = response.render()
>>>   File "C:\Python27\lib\site-packages\django\template\response.py",
>>> line 158, in render
>>> self.content = self.rendered_content
>>>   File "C:\Python27\lib\site-packages\django\template\response.py",
>>> line 135, in rendered_content
>>> content = template.render(context, self._request)
>>>   File
>>> "C:\Python27\lib\site-packages\django\template\backends\django.py",
>>> line 74, in render
>>> return self.template.render(context)
>>>   File "C:\Python27\lib\site-packages\django\template\base.py", line 209
>>> , in render
>>> return self._render(context)
>>>   File "C:\Python27\lib\site-packages\django\template\base.py", line 201
>>> , in _render
>>> return self.nodelist.render(context)
>>>   File "C:\Python27\lib\site-packages\django\template\base.py", line 903
>>> , in render
>>> bit = self.render_node(node, context)
>>>   File "C:\Python27\lib\site-packages\django\template\debug.py", line 79
>>> , in render_node
>>> return node.render(context)
>>>   File "C:\Python27\lib\site-packages\django\template\loader_tags.py",
>>> line 135, in render
>>> return compiled_parent._render(context)
>>>   File "C:\Python27\lib\site-packages\django\template\base.py", line 201
>>> , in _render
>>> return self.nodelist.render(context)
>>>   File "C:\Python27\lib\site-packages\django\template\base.py", line 903
>>> , in render
>>> bit = self.render_node(node, context)
>>>   File "C:\Python27\lib\site-packages\django\template\debug.py", line 79
>>> , in render_node
>>> return node.render(context)
>>>   File "C:\Python27\lib\site-packages\django\template\defaulttags.py",
>>> line 329, in render
>>> return nodelist.render(context)
>>>   File "C:\Python27\lib\site-packages\django\template\base.py", line 903
>>> , in render
>>> bit = self.render_node(node, context)
>>>   File "C:\Python27\lib\site-packages\django\template\debug.py", line 79
>>> , in render_node
>>> return node.render(context)
>>>   File "C:\Python27\lib\site-packages\django\template\defaulttags.py",
>>> line 507, in render
>>> six.reraise(*exc_info)
>>>   File "C:\Python27\lib\site-packages\django\template\defaulttags.py",
>>> line 493, in render
>>> url = reverse(view_name, args=args, kwargs=kwargs, current_app=
>>> current_app)
>>>   File "C:\Python27\lib\site-packages\django\core\urlresolvers.py",
>>> line 579, in reverse
>>> return force_text(iri_to_uri(resolver._reverse_with_prefix(view,
>>> prefix, *args, **kwargs)))
>>>   File "C:\Python27\lib\site-packages\django\core\urlresolvers.py",
>>> line 496, in _reverse_with_prefix
>>> (lookup_view_s, args, kwargs, len(patterns), patterns))
>>> NoReverseMatch: Reverse for '' with arguments '()' and keyword
>>> arguments '{}' not found. 0 pattern(s) tried: []
>>> [13/Jul/2015 15:32:02]"GET /substances/ HTTP/1.1" 500 185051
>>>
>>> It happens when it encounters the first reverse lookup:
>>>
>>>Stubstances
>>>
>>> I've traced it down to the render method in the URLNode class (in
>>> defaulttags), where
>>>
>>> view_name = self.view_name.res

Re: Help me develop a Job Tracker (?)

2015-07-14 Thread Softeisbieger
The FormWizard seems to be a good hint, since my input process consists of 
to steps: First create a Project and specify the Workflow to use. Second, 
show the Tasks for the Project (as indicated by the chosen Workflow / Step) 
and allow the user to tweak the Tasks (change assignee, deadline).

I can't wrap my head around the following: How do I do the second step: I 
have to show multiple forms for the different tasks on a single page 
(FormWizard: ' Define a number of Form 
 
classes – one per wizard page.') and I have to somehow know the chosen 
workflow in the first step... Is this possible with FormWizard? I could 
probably build a single Form for the multiple tasks, but how do I get the 
information on the chosen Workflow?

Essentially this is a two-step process: Based on the choice in step one, do 
something in step two...

Okay, I'll have a look at  WizardView.get_cleaned_data_for_step(*step*) 

 
. This seems to be the right deal...

On Monday, July 13, 2015 at 5:59:32 PM UTC+2, Aaron C. de Bruyn wrote:
>
> You might be looking for the FormWizard. 
>
> In the latest version of Django, it has been moved to an external 
> application (
> https://github.com/django/django-formtools/blob/master/docs/wizard.rst). 
> In older version of Django, it is part of the corp app 
> (https://docs.djangoproject.com/en/1.7/ref/contrib/formtools/form-wizard/). 
>
>
> -A 
>
> On Mon, Jul 13, 2015 at 6:03 AM, Softeisbieger  > wrote: 
> > So I made some progress on this project. I set up the means to manage 
> > customers, which is pretty basic stuff: I usedCreateView, ListView and 
> the 
> > like. 
> > 
> > Now I have a more complex situation where I am stuck: I am now working 
> on 
> > creating projects (see models above). Here I have to implement the 
> > following: 
> > 
> > Choose a work flow 
> > Based on choice in 1. show forms for the project and the different tasks 
> (as 
> > defined by Workflow and Step). Show presets as defined in Workflow / 
> Step. 
> > 
> > My Problem: I don't know how to approach this. Somehow I have to create 
> > Project / Jobs as indicated by the chosen Workflow. Unfortunately this a 
> bit 
> > over my head at the moment: Could you give me rough directions on how to 
> > approach this?  Drop some keywords what is needed to make this work? 
> > 
> > 
> > 
> > -- 
> > 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/c3a735a5-8141-4c5b-bf1a-1ed064daf298%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/9776d520-9717-4e9d-a24b-61d7a753e31e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1.7 to 1.8 upgrade: test suite failing

2015-07-14 Thread tom . szpytman
Hi, yes. Some of my test classes do use setUpClass() without calling 
super().

On Monday, July 13, 2015 at 5:44:03 PM UTC+1, Tim Graham wrote:
>
> Do your test classes use setUpClass() and/or tearDownClass()? If so, are 
> you missing super() calls in those methods?
>
> On Monday, July 13, 2015 at 9:37:03 AM UTC-4, tom.sz...@eporta.com wrote:
>>
>> Thanks for the link
>> This is the commit at which my tests start failing:
>> da9fe5c Fixed #20392 -- Added TestCase.setUpTestData()
>>
>> On Monday, July 13, 2015 at 12:39:57 PM UTC+1, Tim Graham wrote:
>>>
>>> That's a starting point, but there are still a lot of commits between 
>>> 1.8 and 1.7.x. Here's what I meant by "bisecting the commit":
>>>
>>>
>>> https://docs.djangoproject.com/en/dev/internals/contributing/triaging-tickets/#bisecting-a-regression
>>>
>>> On Monday, July 13, 2015 at 5:50:49 AM UTC-4, tom.sz...@eporta.com 
>>> wrote:

 Thanks for the swift reply. The problem starts with Django 1.8.0. My 
 test suite passes on all 1.7.x versions.

 On Friday, July 10, 2015 at 2:32:25 PM UTC+1, Tim Graham wrote:
>
> No ideas, but if you could bisect to find the Django commit where the 
> problem started to appear that will probably help.
>
> On Friday, July 10, 2015 at 7:21:37 AM UTC-4, tom.sz...@eporta.com 
> wrote:
>>
>> Hi,
>>
>> I've recently tried upgrading from Django 1.7.6 to 1.8.3 but haven't 
>> been able to get my test suite to pass.
>>
>> My main problem is that all of the tests pass when run individually, 
>> but when run as an entire test suite, many arbitraily fail due to an 
>> *InterfaceError: 
>> connection already closed*:
>>
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py"
>> , line 838, in execute_sql
>> cursor = self.connection.cursor()
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py"
>> , line 164, in cursor
>> cursor = self.make_cursor(self._cursor())
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py"
>> , line 137, in _cursor
>> return self.create_cursor()
>>   File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", 
>> line 97, in __exit__
>> six.reraise(dj_exc_type, dj_exc_value, traceback)
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py"
>> , line 137, in _cursor
>> return self.create_cursor()
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py"
>> , line 212, in create_cursor
>> cursor = self.connection.cursor()
>> InterfaceError: connection already closed
>>
>>
>>
>> I was previously using psycopg2.6 with Postgres 9.3 and have tried 
>> upgrading to psycopg2.6.1 with Postgres 9.4, but this hasn't helped.
>>
>> Forcing all my TestCase classes to inherit from SimpleTestCase 
>> resolves this issue, but inheriting from SimpleTestCase isn't something 
>> that I wish to do.
>>
>> Any help would be much appreciated.
>>
>> Thanks,
>>
>> Tom
>>
>

-- 
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/cde5149c-42a5-464b-b14e-ae03e15e403a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Opening Django File

2015-07-14 Thread Chaitanaya Sethi
I have created a django file.
How to open it, the place where code can be edited?

-- 
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/9a879a9e-3889-4c15-949c-8ec0416adb63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1.7 to 1.8 upgrade: test suite failing

2015-07-14 Thread Tim Graham
Please try adding the super() calls.

On Tuesday, July 14, 2015 at 5:44:09 AM UTC-4, tom.sz...@eporta.com wrote:
>
> Hi, yes. Some of my test classes do use setUpClass() without calling 
> super().
>
> On Monday, July 13, 2015 at 5:44:03 PM UTC+1, Tim Graham wrote:
>>
>> Do your test classes use setUpClass() and/or tearDownClass()? If so, are 
>> you missing super() calls in those methods?
>>
>> On Monday, July 13, 2015 at 9:37:03 AM UTC-4, tom.sz...@eporta.com wrote:
>>>
>>> Thanks for the link
>>> This is the commit at which my tests start failing:
>>> da9fe5c Fixed #20392 -- Added TestCase.setUpTestData()
>>>
>>> On Monday, July 13, 2015 at 12:39:57 PM UTC+1, Tim Graham wrote:

 That's a starting point, but there are still a lot of commits between 
 1.8 and 1.7.x. Here's what I meant by "bisecting the commit":


 https://docs.djangoproject.com/en/dev/internals/contributing/triaging-tickets/#bisecting-a-regression

 On Monday, July 13, 2015 at 5:50:49 AM UTC-4, tom.sz...@eporta.com 
 wrote:
>
> Thanks for the swift reply. The problem starts with Django 1.8.0. My 
> test suite passes on all 1.7.x versions.
>
> On Friday, July 10, 2015 at 2:32:25 PM UTC+1, Tim Graham wrote:
>>
>> No ideas, but if you could bisect to find the Django commit where the 
>> problem started to appear that will probably help.
>>
>> On Friday, July 10, 2015 at 7:21:37 AM UTC-4, tom.sz...@eporta.com 
>> wrote:
>>>
>>> Hi,
>>>
>>> I've recently tried upgrading from Django 1.7.6 to 1.8.3 but haven't 
>>> been able to get my test suite to pass.
>>>
>>> My main problem is that all of the tests pass when run individually, 
>>> but when run as an entire test suite, many arbitraily fail due to an 
>>> *InterfaceError: 
>>> connection already closed*:
>>>
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py"
>>> , line 838, in execute_sql
>>> cursor = self.connection.cursor()
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py"
>>> , line 164, in cursor
>>> cursor = self.make_cursor(self._cursor())
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py"
>>> , line 137, in _cursor
>>> return self.create_cursor()
>>>   File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", 
>>> line 97, in __exit__
>>> six.reraise(dj_exc_type, dj_exc_value, traceback)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py"
>>> , line 137, in _cursor
>>> return self.create_cursor()
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py"
>>> , line 212, in create_cursor
>>> cursor = self.connection.cursor()
>>> InterfaceError: connection already closed
>>>
>>>
>>>
>>> I was previously using psycopg2.6 with Postgres 9.3 and have tried 
>>> upgrading to psycopg2.6.1 with Postgres 9.4, but this hasn't helped.
>>>
>>> Forcing all my TestCase classes to inherit from SimpleTestCase 
>>> resolves this issue, but inheriting from SimpleTestCase isn't something 
>>> that I wish to do.
>>>
>>> Any help would be much appreciated.
>>>
>>> Thanks,
>>>
>>> Tom
>>>
>>

-- 
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/f6ae38bf-01dd-416d-be9b-f4018806c58f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Match multiple URLs to the same pattern

2015-07-14 Thread Mathew Byrne
I have an application that requires a flat URL structure for multiple 
different views.  The single route r"^[\w\-]+" should start by looking at 
slugs for one Model class, and move onto a Category Model class if no match 
is found, then a Vendor model class, and lastly down to the flatpages app.

I'd like to separate all these models into separate views, but regular 
django urlpatterns wont work here since only the first match is followed.

What's the best way to implement this requirement?  Is there a way I can 
create my own URL matcher and dispatch to a view based on custom logic?  Is 
there a way to re-dispatch a request after the point at which a match was 
made?

Thanks,

Mat

-- 
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/4124aceb-0572-4ee9-ad11-63eb71f71c01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Match multiple URLs to the same pattern

2015-07-14 Thread Avraham Serour
What do you mean by flat URL structure?

In any case you may have a controller called by the URL dispatcher that
decides which view to use to process the request.

No need to complicate on writing you own dispatcher replacement

On Tue, Jul 14, 2015, 4:20 PM Mathew Byrne 
wrote:

> I have an application that requires a flat URL structure for multiple
> different views.  The single route r"^[\w\-]+" should start by looking at
> slugs for one Model class, and move onto a Category Model class if no match
> is found, then a Vendor model class, and lastly down to the flatpages app.
>
> I'd like to separate all these models into separate views, but regular
> django urlpatterns wont work here since only the first match is followed.
>
> What's the best way to implement this requirement?  Is there a way I can
> create my own URL matcher and dispatch to a view based on custom logic?  Is
> there a way to re-dispatch a request after the point at which a match was
> made?
>
> Thanks,
>
> Mat
>
> --
> 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/4124aceb-0572-4ee9-ad11-63eb71f71c01%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/CAFWa6tKunbukyag%3DNkO%3D-E2c61vQErnRqjSgXjnuvO4h1MNgWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help me develop a Job Tracker (?)

2015-07-14 Thread Softeisbieger
First: one cannot use  get_cleaned_data_for_step(*step*) 

 
inside get_form_initial() (see: here 

).

Anyone familiar with FormWizard? I am a bit confused:
I want to use 'get_form_initial' to preset some values based on the choice 
in the previous step. ATM my code looks like this:
class JobWizard(CookieWizardView):
form_list = [forms.JobForm, forms.TaskForm]
def done(self, form_list, **kwargs):
do_something_with_the_form_data(form_list) # todo
return HttpResponseRedirect('/jobs/')

def get_form_initial(self, step):
current_step = self.storage.current_step
print(current_step)
print(self.steps.current)
print('\n') 

if current_step == '1':
return self.initial_dict.get(step, {'deadline': timezone.now()})

return self.initial_dict.get(step, {'street': self.storage.
current_step})  


The problem is that self.steps.current or self.storage.current_step don't 
work as I would expect: When working on the first form (forms.JobForm) it 
is '0' (as expected), but when submitting the first form and advancing to 
the second, it is still '0' (why?). So the above if clause if current_step 
== '1' does not work as I would like it to. Once I submit the second form 
self.steps.current is incremented. So maybe I'm using the wrong variable: 
How do I determine if I'm in the second step? How can I rename the step 
names? 

My goal at first is to load data from the first step and use it to preset 
some of the fields of the second step. Once that works I need to somehow 
create a formset for the different tasks... 

-- 
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/c7887c1a-52ad-47cb-bf12-42f39bcb7d79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Opening Django File

2015-07-14 Thread Great Avenger Singh
On Tue, Jul 14, 2015 at 2:45 PM, Chaitanaya Sethi
 wrote:

> I have created a django file.
> How to open it, the place where code can be edited?

Question seems very vague. Django files are mostly Python Files with
.py extension, So you can use any editor. or be more specific to your
question.


-- 

Thanks
Arshpreet Singh

I am Sikh boy, Learning by doing and Learning by teaching is my religion.
--
Slashdot TV.
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/

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


Re: How to save base64 string in Python django

2015-07-14 Thread Bill Freeman
You don't show where the 'Image' object comes from (in Image.open), so I
can't be specific, but here are some generalities:

"Incorrect padding" is probably a message from the base 64 decoder.
Capture your request.POST[photo] to play with separately.  If you are doing
this under the development server you can add a pdb.set_trace() to get a
prompt where you can play with things.  Alternatively, put the decode and
the StringIO creation in separate statements so the the line generating the
error will be clear.

Are you sure that the image is base 64?  If it's coming from a file field
in an HTML form, it probably isn't, which would explain the decode error
(it I'm correct and it is a decoder error).

It is customary to store images on the file system, putting only the path
to the file in the database, as part of a model instance. That way the
front end server (Apache or nginx, etc.) can serve the images without
involving python and the database..  There are image oriented model fields
available in django to facilitate this, see the excellent documentation.

If, for whatever reason, you must store the image in the database, you can
store it as a (binary) string.  If your image object makes the data
available as a string, there will be no need to pump it through a StringIO
object.

On Mon, Jul 13, 2015 at 7:40 AM, ywaghmare5203 
wrote:

> Hello all,
>
> I am trying to save base64 string string image to database but I am not
> able to store. I am beginner for python django language.
>
> I am following these steps:--
>
> from base64 import b64decode
> from django.core.files.base import ContentFile
> from time import time
> import cStringIO
> import base64
>
>
> pic = cStringIO.StringIO()
> image_string =
> cStringIO.StringIO(base64.b64decode(request.POST['photo']))
> image = Image.open(image_string)
> image.save(pic, image.format, quality = 100)
> pic.seek(0)
> return HttpResponse(pic, content_type='image/jpeg')
>
> but I have error
>
> TypeError: Incorrect padding
>
> Please help me for store the base64 image string in the database.
>
>
> Thanks & Regards,
>
> Yogesh Waghnare
>
> --
> 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/54b12c7e-e9b0-4a47-85ce-988c897bbd11%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%2BAj0v_qnReqeKyVib48_8qRGwo9Qs4LY%2BVn1iNX5DjAbVCcQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Match multiple URLs to the same pattern

2015-07-14 Thread Bill Freeman
You will want a routing view, or a fallback cascade.  In either case, make
that urlpattern r'^([\w-]+)$'.  You don't need to escape the - because it's
the last char in the class.  You don want to restrict the urls to those in
which the entire url matches (^ and $), and the parentheses capture the
string as a positional argument to the view.  Your view could then call sub
views, something like this:

def router(request, key):
try:
return model1_view(request, key)
except django.http.Http404:
pass
and as many more try blocks as you need.

Don't put the last sub view in a try lock so that if it's not found
anywhere, the 404 takes its natural course.

Each view can use the get_object_or_404() shortcut, or whatever floats your
boat.  It's just that they should raise Http404, rather than formatting the
404 response themselves and returning it

The sub views can be class based, so long as they raise Http404 for no such
key, or be function views

Doing the outer, routing view, as a class based view is probably less clear
(less explicit), and is left as an exercise for the student, if you really
want it.

On Tue, Jul 14, 2015 at 9:26 AM, Avraham Serour  wrote:

> What do you mean by flat URL structure?
>
> In any case you may have a controller called by the URL dispatcher that
> decides which view to use to process the request.
>
> No need to complicate on writing you own dispatcher replacement
>
> On Tue, Jul 14, 2015, 4:20 PM Mathew Byrne 
> wrote:
>
>> I have an application that requires a flat URL structure for multiple
>> different views.  The single route r"^[\w\-]+" should start by looking at
>> slugs for one Model class, and move onto a Category Model class if no match
>> is found, then a Vendor model class, and lastly down to the flatpages app.
>>
>> I'd like to separate all these models into separate views, but regular
>> django urlpatterns wont work here since only the first match is followed.
>>
>> What's the best way to implement this requirement?  Is there a way I can
>> create my own URL matcher and dispatch to a view based on custom logic?  Is
>> there a way to re-dispatch a request after the point at which a match was
>> made?
>>
>> Thanks,
>>
>> Mat
>>
>> --
>> 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/4124aceb-0572-4ee9-ad11-63eb71f71c01%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/CAFWa6tKunbukyag%3DNkO%3D-E2c61vQErnRqjSgXjnuvO4h1MNgWA%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/CAB%2BAj0tqarv1v7Cz4dnV_f62gex_DUCJOxfifmerkFVH5Y%2BaaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Celery to process task and modify the model fields

2015-07-14 Thread Robin Lery
I would like to convert video into mp4 using ffmpeg and celery for the
asynchronous task. When user uploads a video, it will be for the
original_video and save it. After that I want celery to convert it into a
different version for the mp4_720 field. However I am confused on how to
apply that logic using celery.

app.models.py:

class Video(models.Model):
title = models.CharField(max_length=75)
pubdate = models.DateTimeField(default=timezone.now)
original_video = models.FileField(upload_to=get_upload_file_name)
mp4_720 = models.FileField(upload_to=get_upload_file_name,
blank=True, null=True)
converted = models.BooleanField(default=False)

app.views.py:

def upload_video(request):
if request.POST:
form = VideoForm(request.POST, request.FILES)
if form.is_valid():
video = form.save(commit=False)
video.save()

// Celery to convert the video
convert_video.delay(video)

return HttpResponseRedirect('/')
else:
form = VideoForm()
return render(request, 'upload_video.html', {
'form':form
})

app.tasks.py:

@app.task
def convert_video(video):

// Convert the original video into required format and save it in
the mp4_720 field using the following command:
//subprocess.call('ffmpeg -i (path of the original_video) (video
for mp4_720)')

// Change the converted boolean field to True

// Save

Basically my question is how to save the converted video in mp4_720. Your
help and guidance will be very much appreciated. 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/CA%2B4-nGrKucaFSi7oZoOcHtOXdSsnPEac2_LXLZ2TccRCaWUhzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to save base64 string in Python django

2015-07-14 Thread Sadaf Noor
If you can avoid saving images to database then the solution would look
like following where you are serving base64 url of image to reduce your
website data bandwidth:


   1. from django.db import models
   2. class Photo( models.Model ):
   3. title = models.CharField( max_length=255 )
   4. image = models.ImageField( upload_to="photos/", max_length=255)
   5. @property
   6. def image_url( self ):
   7. try:
   8. img = open( self.image.path, "rb")
   9. data = img.read()
   10. return "data:image/jpg;base64,%s" % data.encode('base64')
   11.
   12. except IOError:
   13. return self.image.url


2015-07-14 20:46 GMT+06:00 Bill Freeman :

> You don't show where the 'Image' object comes from (in Image.open), so I
> can't be specific, but here are some generalities:
>
> "Incorrect padding" is probably a message from the base 64 decoder.
> Capture your request.POST[photo] to play with separately.  If you are doing
> this under the development server you can add a pdb.set_trace() to get a
> prompt where you can play with things.  Alternatively, put the decode and
> the StringIO creation in separate statements so the the line generating the
> error will be clear.
>
> Are you sure that the image is base 64?  If it's coming from a file field
> in an HTML form, it probably isn't, which would explain the decode error
> (it I'm correct and it is a decoder error).
>
> It is customary to store images on the file system, putting only the path
> to the file in the database, as part of a model instance. That way the
> front end server (Apache or nginx, etc.) can serve the images without
> involving python and the database..  There are image oriented model fields
> available in django to facilitate this, see the excellent documentation.
>
> If, for whatever reason, you must store the image in the database, you can
> store it as a (binary) string.  If your image object makes the data
> available as a string, there will be no need to pump it through a StringIO
> object.
>
> On Mon, Jul 13, 2015 at 7:40 AM, ywaghmare5203 
> wrote:
>
>> Hello all,
>>
>> I am trying to save base64 string string image to database but I am not
>> able to store. I am beginner for python django language.
>>
>> I am following these steps:--
>>
>> from base64 import b64decode
>> from django.core.files.base import ContentFile
>> from time import time
>> import cStringIO
>> import base64
>>
>>
>> pic = cStringIO.StringIO()
>> image_string =
>> cStringIO.StringIO(base64.b64decode(request.POST['photo']))
>> image = Image.open(image_string)
>> image.save(pic, image.format, quality = 100)
>> pic.seek(0)
>> return HttpResponse(pic, content_type='image/jpeg')
>>
>> but I have error
>>
>> TypeError: Incorrect padding
>>
>> Please help me for store the base64 image string in the database.
>>
>>
>> Thanks & Regards,
>>
>> Yogesh Waghnare
>>
>> --
>> 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/54b12c7e-e9b0-4a47-85ce-988c897bbd11%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%2BAj0v_qnReqeKyVib48_8qRGwo9Qs4LY%2BVn1iNX5DjAbVCcQ%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
  Md. Sadaf Noor (@sadaf2605 )
 www.sadafnoor.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/CAAJ2eVqFzYNhx9FyMW2i%2BATc%3DZ0MWHj%2Bhxb2DwmF%3DpD%3DaXa60w%40mail

Re: Opening Django File

2015-07-14 Thread Sadaf Noor
There is a thing called IDE:
https://en.wikipedia.org/wiki/Integrated_development_environment

PyCharm (https://www.jetbrains.com/pycharm/) is my personal fevorite,
Cheers!


2015-07-14 20:23 GMT+06:00 Great Avenger Singh :

> On Tue, Jul 14, 2015 at 2:45 PM, Chaitanaya Sethi
>  wrote:
>
> > I have created a django file.
> > How to open it, the place where code can be edited?
>
> Question seems very vague. Django files are mostly Python Files with
> .py extension, So you can use any editor. or be more specific to your
> question.
>
>
> --
>
> Thanks
> Arshpreet Singh
>
> I am Sikh boy, Learning by doing and Learning by teaching is my religion.
>
> --
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
>
> --
> 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/CAAstK2Ed5OQ%2BpY8LL28BqW4LWE2peAni2mdhfZp%3DrwOjQ8r%3DuA%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
  Md. Sadaf Noor (@sadaf2605 )
 www.sadafnoor.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/CAAJ2eVrfD9ndFJ7LcVYntWEmht4JGamy8t%3DEvwY1X19HuEBJuA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Opening Django File

2015-07-14 Thread Nikolas Stevenson-Molnar
Yes, PyCharm is great. Also have a look at Sublime Text: 
https://www.sublimetext.com/


And for free, check out GitHub's Atom: https://atom.io/

_Nik

On 7/14/2015 11:58 AM, Sadaf Noor wrote:
There is a thing called IDE: 
https://en.wikipedia.org/wiki/Integrated_development_environment


PyCharm (https://www.jetbrains.com/pycharm/) is my personal fevorite, 
Cheers!



2015-07-14 20:23 GMT+06:00 Great Avenger Singh >:


On Tue, Jul 14, 2015 at 2:45 PM, Chaitanaya Sethi
mailto:chaitanayaseth...@gmail.com>>
wrote:

> I have created a django file.
> How to open it, the place where code can be edited?

Question seems very vague. Django files are mostly Python Files with
.py extension, So you can use any editor. or be more specific to your
question.


--

Thanks
Arshpreet Singh

I am Sikh boy, Learning by doing and Learning by teaching is my
religion.

--
Slashdot TV.
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/

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




--
 Md. Sadaf Noor (@sadaf2605 )
www.sadafnoor.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/CAAJ2eVrfD9ndFJ7LcVYntWEmht4JGamy8t%3DEvwY1X19HuEBJuA%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/55A55E18.1030306%40consbio.org.
For more options, visit https://groups.google.com/d/optout.


Re: Celery to process task and modify the model fields

2015-07-14 Thread Vijay Khemlani
I remember this question from... february I think, what's changed since
then?

On Tue, Jul 14, 2015 at 3:29 PM, Robin Lery  wrote:

> I would like to convert video into mp4 using ffmpeg and celery for the
> asynchronous task. When user uploads a video, it will be for the
> original_video and save it. After that I want celery to convert it into a
> different version for the mp4_720 field. However I am confused on how to
> apply that logic using celery.
>
> app.models.py:
>
> class Video(models.Model):
> title = models.CharField(max_length=75)
> pubdate = models.DateTimeField(default=timezone.now)
> original_video = models.FileField(upload_to=get_upload_file_name)
> mp4_720 = models.FileField(upload_to=get_upload_file_name,
> blank=True, null=True)
> converted = models.BooleanField(default=False)
>
> app.views.py:
>
> def upload_video(request):
> if request.POST:
> form = VideoForm(request.POST, request.FILES)
> if form.is_valid():
> video = form.save(commit=False)
> video.save()
>
> // Celery to convert the video
> convert_video.delay(video)
>
> return HttpResponseRedirect('/')
> else:
> form = VideoForm()
> return render(request, 'upload_video.html', {
> 'form':form
> })
>
> app.tasks.py:
>
> @app.task
> def convert_video(video):
>
> // Convert the original video into required format and save it in
> the mp4_720 field using the following command:
> //subprocess.call('ffmpeg -i (path of the original_video) (video
> for mp4_720)')
>
> // Change the converted boolean field to True
>
> // Save
>
> Basically my question is how to save the converted video in mp4_720. Your
> help and guidance will be very much appreciated. 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/CA%2B4-nGrKucaFSi7oZoOcHtOXdSsnPEac2_LXLZ2TccRCaWUhzA%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/CALn3ei3nZcbL5REM75Q1DVgoQud5oUMf%3Dhv3qLxuzJT1EiJ4wg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: python manage.py makemigrations polls

2015-07-14 Thread Auj Snow
Thanks for the help. I figured it out. I wasn't in the right directory!

On Monday, July 13, 2015 at 10:56:52 PM UTC-4, Auj Snow wrote:
>
> When I try to run "python manage.py makemigrations polls" in my terminal, 
> I get an error "No changes detected in app 'polls' "
>
> I have saved the 'polls' in the INSTALLED_APPS but I just don't understand 
> how to fix this. 
>
> Any help would be 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/968ab025-4d46-4d93-8ec2-6a98d294fe88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Celery to process task and modify the model fields

2015-07-14 Thread Robin Lery
Yes. That time you were the one to guide me. I was looking at other
projects after that.

I am just confused on how to get the video.mp4_720 to be the converted
video. Will you please help.

Thank you.

On Wed, Jul 15, 2015 at 1:15 AM, Vijay Khemlani  wrote:

> I remember this question from... february I think, what's changed since
> then?
>
> On Tue, Jul 14, 2015 at 3:29 PM, Robin Lery  wrote:
>
>> I would like to convert video into mp4 using ffmpeg and celery for the
>> asynchronous task. When user uploads a video, it will be for the
>> original_video and save it. After that I want celery to convert it into
>> a different version for the mp4_720 field. However I am confused on how
>> to apply that logic using celery.
>>
>> app.models.py:
>>
>> class Video(models.Model):
>> title = models.CharField(max_length=75)
>> pubdate = models.DateTimeField(default=timezone.now)
>> original_video = models.FileField(upload_to=get_upload_file_name)
>> mp4_720 = models.FileField(upload_to=get_upload_file_name,
>> blank=True, null=True)
>> converted = models.BooleanField(default=False)
>>
>> app.views.py:
>>
>> def upload_video(request):
>> if request.POST:
>> form = VideoForm(request.POST, request.FILES)
>> if form.is_valid():
>> video = form.save(commit=False)
>> video.save()
>>
>> // Celery to convert the video
>> convert_video.delay(video)
>>
>> return HttpResponseRedirect('/')
>> else:
>> form = VideoForm()
>> return render(request, 'upload_video.html', {
>> 'form':form
>> })
>>
>> app.tasks.py:
>>
>> @app.task
>> def convert_video(video):
>>
>> // Convert the original video into required format and save it in
>> the mp4_720 field using the following command:
>> //subprocess.call('ffmpeg -i (path of the original_video) (video
>> for mp4_720)')
>>
>> // Change the converted boolean field to True
>>
>> // Save
>>
>> Basically my question is how to save the converted video in mp4_720. Your
>> help and guidance will be very much appreciated. 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/CA%2B4-nGrKucaFSi7oZoOcHtOXdSsnPEac2_LXLZ2TccRCaWUhzA%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/CALn3ei3nZcbL5REM75Q1DVgoQud5oUMf%3Dhv3qLxuzJT1EiJ4wg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Playing with API- DjangoProject Part 1

2015-07-14 Thread Auj Snow
When I run the shell, I keep getting errors. Also, I have created the 
question three times now so when I type q.id , I get a return value of 3. 
How can I delete them. Also when I ask the question text (q.question_text) 
I get "" instead of the "Whats up". 

Any help would be greatly appreciated. 

*The error when I run the shell:*

q$ python manage.py shell
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
 
RuntimeWarning: Model 'polls.question' was already registered. Reloading 
models is not advised as it can lead to inconsistencies, most notably with 
related models.
  new_class._meta.apps.register_model(new_class._meta.app_label, new_class)

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
 
RuntimeWarning: Model 'polls.choice' was already registered. Reloading 
models is not advised as it can lead to inconsistencies, most notably with 
related models.
  new_class._meta.apps.register_model(new_class._meta.app_label, new_class)

Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> 

-- 
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/46c118d5-7b70-4575-b714-edf2d05334b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Where to put wsgi code in Apache in Ubuntu?

2015-07-14 Thread Christian Kleineidam
I have create a new file named dj.conf and put it 
into  /etc/apache2/sites-available/.
The text of the file is: 

__
WSGIScriptAlias / /root/konnekt/pro/konsite/konsite/wsgi.py
WSGIPythonPath /root/konnekt/pro/konsite/konsite



Require all granted


_

When I run a2ensite it asks me for the site I want to enable and I type dj.
That works fine but when I do the reload I get the error:

_
 * Reloading web server apache2 
 *
 * The apache2 configtest failed. Not doing anything.
Output of config test was:
AH00526: Syntax error on line 1 of /etc/apache2/sites-enabled/dj.conf:
Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a 
module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
__

What is wrong with what I'm doing?



On Monday, July 13, 2015 at 1:23:52 AM UTC+2, Alex wrote:
>
> On ubuntu using vhosts, /etc/apache2/sites-available/
>
> then run a2ensite to enable the conf you make, if you just toss the conf 
> into default an apache reload is all you need.
>
> -Alex
> On Jul 12, 2015 3:56 PM, John  > wrote:
>
> If your install of apache is httpd, /etc/httpd/
>
> If is apache2, /etc/apache2/
>
> Under this folder, you may have conf and conf.d directories. You will find 
> the httpd.conf of apache2.conf ;)
>
>
>
> On Jul 12, 2015, at 7:54 PM, Christian Kleineidam  > wrote:
>
> The Django documentation 
>  tell 
> me to put
>
> WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py
> WSGIPythonPath /path/to/mysite.com
>
> 
> 
> Require all granted
> 
> 
>
> Into the httpd.conf-file. Such a file doesn't exist on Ubuntu. Where does 
> it go?
> (I also posted this question to stackexchange but didn't get an answer 
> over there: 
> http://unix.stackexchange.com/questions/215179/where-do-i-put-the-information-for-django-in-apache2-in-ubuntu
> )
>
> -- 
> 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/42dfb499-c5ee-433d-ab6a-49b03ddb5d75%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...@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/8355CE53-EEB4-490F-8F52-DB7F6E170A3A%40me.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/a9731514-533d-420f-9a7f-7509cf84f66d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


preserve data when migrating ForeignKey to ManyToManyField

2015-07-14 Thread A Lee
I'd like to change a ForeignKey field into a ManyToManyField, preserving 
existing data by creating entries in the many-to-many through table. 
Running makemigrations after changing the model class creates a migration 
that executes a RemoveField on the existing ForeignKey field and then an 
AddField on the new ManyToManyField, which destroys any existing ForeignKey 
data.

I ended up implementing this by creating three migrations:

1. schema migration: create the new ManyToManyField
2. data migration: copy existing ForeignKey data into the ManyToManyField
3. schema migration: remove the ForeignKey field and rename the 
ManyToManyField

Is there a simpler way to do this type of schema change?

-- 
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/7981c18a-217f-4668-b8af-ea234bcad408%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Playing with API- DjangoProject Part 1

2015-07-14 Thread Néstor
This worked for me in ubuntu:
python manage.py shell
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)

*>>> from polls.models import Question, Choice*
*>>> from django.utils import timezone*

*>>> q = Question(question_text="What's up?", pub_date=timezone.now())*

*>>> q.save()*
*>>> q.id *
1
*>>> q.question_text*
"What's up?"


I just did the above and I got a message
from this page url:*https://docs.djangoproject.com/en/1.8/intro/tutorial01/
*

I hope this helps, try it again


On Tue, Jul 14, 2015 at 1:47 PM, Auj Snow  wrote:

> When I run the shell, I keep getting errors. Also, I have created the
> question three times now so when I type q.id , I get a return value of 3.
> How can I delete them. Also when I ask the question text (q.question_text)
> I get "" instead of the "Whats up".
>
> Any help would be greatly appreciated.
>
> *The error when I run the shell:*
>
> q$ python manage.py shell
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
> RuntimeWarning: Model 'polls.question' was already registered. Reloading
> models is not advised as it can lead to inconsistencies, most notably with
> related models.
>   new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
>
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
> RuntimeWarning: Model 'polls.choice' was already registered. Reloading
> models is not advised as it can lead to inconsistencies, most notably with
> related models.
>   new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
>
> Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>>
>
>  --
> 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/46c118d5-7b70-4575-b714-edf2d05334b3%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/CAON-vCPEDhVuEjc02_smiE8CATcbqN2FRHoAh9mQHN6wVLEuXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[no subject]

2015-07-14 Thread monoBOT
​I want to test some views in DRF project.

The problem comes when i try to check views that have arguments in the urls.

urls.py

url(r'^(?
​<​
Pcompany_hash>[\d\w]+)/(?
​<​
Ptimestamp>[\.\d]*)/employees/$',
EmployeeList.as_view(), name='employeelist'),



views.py

class EmployeeList(ListCreateAPIView):
serializer_class = EmployeeDirectorySerializer

def inner_company(self):
company_hash = self.kwargs['company_hash']
return get_company(company_hash)

def get_queryset(self):
return Employee.objects.filter(company=self.inner_company())

test.py

class ApiTests(APITestCase):
def setUp(self):
self.factory = APIRequestFactory()
self.staff = mommy.make('directory.Employee', user__is_staff=True)
self.employee = mommy.make('directory.Employee')

self.hash = self.employee.company.company_hash

def getResponse(self, url, myView):
view = myView.as_view()
request = self.factory.get(url, kwargs)

force_authenticate(request, user=user)

response = view(request)
return response

def test_EmployeeList(self):
kwargs = {'timestamp': 0, 'company_hash': self.hash}
url = reverse('employeelist', kwargs=kwargs)
testedView = EmployeeList

response = self.getResponse(url, testedView,
kwargs=kwargs)
self.assertEqual(response.status_code, 200)

im getting this error

company_hash = self.kwargs['company_hash']
KeyError: 'company_hash'

That is the args aren't been passed to the view.

I've tryed in so different ways to pass by the args, cant find a sollution.
Any help is welcomed!​

This question has also been asked in Stackoverflow for if you preefer to
answer there!
http://stackoverflow.com/questions/31406106/how-can-i-correctly-pass-arguments-to-classbasedviews-testing-django-rest-framew


-- 
*monoBOT*
Visite mi sitio(Visit my site): monobotsoft.es/blog/

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


Re: Playing with API- DjangoProject Part 1

2015-07-14 Thread James Schneider
> When I run the shell, I keep getting errors. Also, I have created the
> question three times now so when I type q.id , I get a return value of 3.
> How can I delete them. 

Easy enough.

q.delete()

You may have to perform a query to gather up the other questions that
you've already created and perform delete operations on each of those.


>  Also when I ask the question text (q.question_text) I
> get "" instead of the "Whats up".


That is odd. I'd be interested to see the series of commands that you
are running to get this result. Can you paste everything that you are
typing into the shell and all of the responses? It's almost as though
you've done something like p.question_text = p before printing out p.


>
> Any help would be greatly appreciated.
>
> The error when I run the shell:
>
> q$ python manage.py shell
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
> RuntimeWarning: Model 'polls.question' was already registered. Reloading
> models is not advised as it can lead to inconsistencies, most notably with
> related models.
>   new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
>
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
> RuntimeWarning: Model 'polls.choice' was already registered. Reloading
> models is not advised as it can lead to inconsistencies, most notably with
> related models.
>   new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
>
> Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)

>

While I've never seen this error before, it would seem that something
is amiss in your models.py and/or possibly your admin.py. I've seen a
few google posts saying that this error was received because they were
importing models in both models.py and in admin.py.

Please post both files, along with your settings.py, which may shed
more light on the issue.

-James

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


design decision tree survey using django admin interface

2015-07-14 Thread anc
I need to build a survey tool which provides an interface to the survey 
administrator to add/edit/delete questions. I understand we can do it 
through the admin interface. But can we modify the admin interface to 
provide branched/skip logic feature so that the administrator can design a 
survey where the next question to be displayed will depend on the answer of 
the previous question? I mean this branch logic feature will allow the 
survey administrator to create a decision tree survey.


Thanks,
Ananya

-- 
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/c869-d9a2-4bf2-a370-efd77ad2e925%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to render a grouped list to a template

2015-07-14 Thread abnerpc
You need to use regroup:
https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#regroup

On Sun, Jul 12, 2015 at 8:44 PM, Andrea  wrote:

> Hello. I'm new to both django and python.
>
> This in an example code i made up to illustrate my problem:
> # Models
> class Book(models.Model):
> submitted_by = models.ForeignKey(settings.AUTH_USER_MODEL,
> related_name='book_subby')
> submitted_date = models.DateField(auto_now=True)
> book_title = models.CharField(max_length=200)
> book_publisher = models.ForeignKey(Publishers)
>
>
> class Publishers(models.Model):
> submitted_by = models.ForeignKey(settings.AUTH_USER_MODEL,
> related_name='publisher_subby')
> submitted_date = models.DateField(auto_now=True)
> book_publisher = models.CharField(max_length=200)
>
> # View
> def book_list(request):
> books = Book.objects.filter(submitted_by=request.user,
> submitted_date__lte=timezone.now()).order_by('submitted_date')
> books_by_publisher =
> return render(request, 'book/list_books.html', {
> 'books': books
> })
>
> # Template list_books.html
> {% for book in books %}
>  {{ book.book_publisher }}
>  {{book.book_title }} 
> {% endfor %}
>
> This displays:
>
> Publisher X
> * Book A
> Publisher Y
> * Book B
> Publisher X
> * Book C
> Publisher Y
> * Book D
>
> I want to display:
> Publisher X
> * Book A
> * Book C
>
> Publisher Y
> * Book B
> * Book D
>
> I tried doing multiple for loops in the template, but couldn't make it
> work.
> I would appreciate it alot if someone could nudge me in the right
> direction on how to solve this.
> Thanks, Andrea
>
> --
> 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/b869f4f3-8d80-4468-a1e8-1077c1bf5378%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Abner Campanha

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


Re:

2015-07-14 Thread James Schneider
Check your regex syntax in your URL conf. You aren't capturing the named
group correctly. You have (?https://docs.djangoproject.com/en/1.8/topics/http/urls/#named-groups

-James
On Jul 14, 2015 3:32 PM, "monoBOT"  wrote:

>
> ​I want to test some views in DRF project.
>
> The problem comes when i try to check views that have arguments in the
> urls.
>
> urls.py
>
> url(r'^(?
> ​<​
> Pcompany_hash>[\d\w]+)/(?
> ​<​
> Ptimestamp>[\.\d]*)/employees/$',
> EmployeeList.as_view(), name='employeelist'),
>
>
>
> views.py
>
> class EmployeeList(ListCreateAPIView):
> serializer_class = EmployeeDirectorySerializer
>
> def inner_company(self):
> company_hash = self.kwargs['company_hash']
> return get_company(company_hash)
>
> def get_queryset(self):
> return Employee.objects.filter(company=self.inner_company())
>
> test.py
>
> class ApiTests(APITestCase):
> def setUp(self):
> self.factory = APIRequestFactory()
> self.staff = mommy.make('directory.Employee', user__is_staff=True)
> self.employee = mommy.make('directory.Employee')
>
> self.hash = self.employee.company.company_hash
>
> def getResponse(self, url, myView):
> view = myView.as_view()
> request = self.factory.get(url, kwargs)
>
> force_authenticate(request, user=user)
>
> response = view(request)
> return response
>
> def test_EmployeeList(self):
> kwargs = {'timestamp': 0, 'company_hash': self.hash}
> url = reverse('employeelist', kwargs=kwargs)
> testedView = EmployeeList
>
> response = self.getResponse(url, testedView,
> kwargs=kwargs)
> self.assertEqual(response.status_code, 200)
>
> im getting this error
>
> company_hash = self.kwargs['company_hash']
> KeyError: 'company_hash'
>
> That is the args aren't been passed to the view.
>
> I've tryed in so different ways to pass by the args, cant find a sollution.
> Any help is welcomed!​
>
> This question has also been asked in Stackoverflow for if you preefer to
> answer there!
>
> http://stackoverflow.com/questions/31406106/how-can-i-correctly-pass-arguments-to-classbasedviews-testing-django-rest-framew
>
>
> --
> *monoBOT*
> Visite mi sitio(Visit my site): monobotsoft.es/blog/
>
> --
> 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%2BxOsGAi8UxtXOV8HngqWXX6G31%2BfY7%3DDBCoYZk%3DToEed4eoHA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: How to debug? -- DoesNotExist at /admin/login/

2015-07-14 Thread Sergiy Khohlov
Looks like you have missed char. Admi/login is requested not admin. I hope
it is typo
14 лип. 2015 00:13 "elim"  пише:

> I got error when I did
> $ python manage.py runserver
> Performing system checks...
>
> System check identified no issues (0 silenced).
> July 13, 2015 - 20:42:02
> Django version 1.8.3, using settings 'mysite.settings'
> Starting development server at http://127.0.0.1:8000/
> Quit the server with CONTROL-C.
> [13/Jul/2015 20:42:10]"GET /admin/ HTTP/1.1" 302 0
> [13/Jul/2015 20:42:10]"GET /admin/login/?next=/admin/ HTTP/1.1" 500 152252
> [13/Jul/2015 20:42:11]"GET /favicon.ico HTTP/1.1" 404 1936
>
> submit the url  http://localhost:8000/admin/  in browser I got error
> below:
>
> DoesNotExist at /admi/login/
> Site matching query does not exist.
> Request Method: GET
> Request URL: http://localhost:8000/admin/login/?next=/admin/
> Django Version: 1.8.3
> Exception Type: DoesNotExist
> Exception Value:
> Site matching query does not exist.
> Exception Location: 
> /usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/models/query.py
> in get, line 334
> Python Executable: /usr/bin/python
> Python Version: 2.7.6
> Python Path:
> ['/home/elim/Projects/python/mydjango',
>  '/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg',
>  '/usr/lib/python2.7',
>  '/usr/lib/python2.7/plat-x86_64-linux-gnu',
>  '/usr/lib/python2.7/lib-tk',
>  '/usr/lib/python2.7/lib-old',
>  '/usr/lib/python2.7/lib-dynload',
>  '/usr/local/lib/python2.7/dist-packages',
>  '/usr/lib/python2.7/dist-packages',
>  '/usr/lib/python2.7/dist-packages/PILcompat',
>  '/usr/lib/python2.7/dist-packages/gst-0.10',
>  '/usr/lib/python2.7/dist-packages/gtk-2.0',
>  '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
> Server time: Mon, 13 Jul 2015 20:42:10 +
>
> I'd like to know how to debug this. What's "Site matching query does not
> exist." mean?
> How to fix this?
>
> 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/772e41c0-4ca6-44da-be85-358d78e8b884%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/CADTRxJOej5WWkPbtk9Qnu2bEf8zqhc75DNFqSNf5wPaL_S9%3Dmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: design decision tree survey using django admin interface

2015-07-14 Thread Luis Zárate
I know it is not the answer of your question but for your survey design it
is important that you see this links.

https://github.com/chrisglass/django_polymorphic
https://github.com/django-mptt/django-mptt/

I know that because I did a survey app years ago, but unfortunately it is
not free and it is in spanish too.



2015-07-14 17:32 GMT-06:00 anc :

> I need to build a survey tool which provides an interface to the survey
> administrator to add/edit/delete questions. I understand we can do it
> through the admin interface. But can we modify the admin interface to
> provide branched/skip logic feature so that the administrator can design a
> survey where the next question to be displayed will depend on the answer of
> the previous question? I mean this branch logic feature will allow the
> survey administrator to create a decision tree survey.
>
>
> Thanks,
> Ananya
>
> --
> 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/c869-d9a2-4bf2-a370-efd77ad2e925%40googlegroups.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%2B5VyMxpBuaMXm728DuaTh-TXmQ2jrjjiZ9qjTw7i7%3DBoFF0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.