Re: Is django framework feasible for developing online LMS?

2014-11-13 Thread Pradip Shahi


> *Avraham Serour,*

Sorry man, I mean to heart django guys..
I am pretty much sure with mysql as a backend and javascript on client.
Would you help me decide on web server.. I had some research on Apache with 
mod wsgi, gnuicorn and nginx.
Thank you.

*Ari Davidow,*
I really appreciate your suggestion and had a look at edX. It's a cool open 
source LMS. But what i wanna do is, It's my FYP project, I wanna built 
simple system with online course delivery and its administration. My main 
motto is to learn django rather than just complete the system. OpenedX is a 
cool thing to think in real time implementation. Hope more other suggestion 
from you.
Thank you!

Scot Hacker,
Thanks man.

Krmane,
No man gnowledge is something different from my project nyways thank you. 
will look at it for more.









-- 
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/df11c25a-6085-4e63-ad96-54b78ae0eca6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Admin Page Error

2014-11-13 Thread Daniel Pek
Hi, 

I'm new to Django, and I've been following the tutorial up until the 2nd 
part where it asks your to runserver, and then access the admin page. 
However, when i try to access 127.0.0.1:8000/admin/ i get this error:

Here is the traceback:

*Environment:*


*Request Method: GET*
*Request URL: http://127.0.0.1:8000/admin/*

*Django Version: 1.7.1*
*Python Version: 2.7.8*
*Installed Applications:*
*('django.contrib.admin',*
* 'django.contrib.auth',*
* 'django.contrib.contenttypes',*
* 'django.contrib.sessions',*
* 'django.contrib.messages',*
* 'django.contrib.staticfiles',*
* 'polls')*
*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')*


*Traceback:*
*File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in 
get_response*
*  111. response = wrapped_callback(request, 
*callback_args, **callback_kwargs)*
*File "/Library/Python/2.7/site-packages/django/contrib/admin/sites.py" in 
wrapper*
*  225. return self.admin_view(view, cacheable)(*args, 
**kwargs)*
*File "/Library/Python/2.7/site-packages/django/utils/decorators.py" in 
_wrapped_view*
*  105. response = view_func(request, *args, **kwargs)*
*File "/Library/Python/2.7/site-packages/django/views/decorators/cache.py" 
in _wrapped_view_func*
*  52. response = view_func(request, *args, **kwargs)*
*File "/Library/Python/2.7/site-packages/django/contrib/admin/sites.py" in 
inner*
*  199. from django.contrib.auth.views import 
redirect_to_login*
*File "/Library/Python/2.7/site-packages/django/contrib/auth/views.py" in 
*
*  8. from django.shortcuts import resolve_url*

*Exception Type: ImportError at /admin/*
*Exception Value: cannot import name resolve_url*

and the error on the browser is:

ImportError at /admin/

cannot import name resolve_url

Request Method:GETRequest URL:http://127.0.0.1:8000/admin/Django Version:
1.7.1Exception Type:ImportErrorException Value:

cannot import name resolve_url

Exception 
Location:/Library/Python/2.7/site-packages/django/contrib/auth/views.py 
in , line 8Python Executable:
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/PythonPython
 
Version:2.7.8Python Path:

['/Users/___/Documents/projects/speakeasy',
 '/Library/Python/2.7/site-packages/pip-1.5.1-py2.7.egg',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
 '/Library/Python/2.7/site-packages',
 '/Library/Python/2.7/site-packages/PIL']

Server time:Fri, 14 Nov 2014 14:09:33 +1100

I dont know what is wrong? I think it might be a pathing problem with 
Python but im not entirely sure, any help would be awesome, 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/48ddeafa-708b-49e4-8fbc-4a5f475a9d11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django + Database Connections

2014-11-13 Thread Russell Keith-Magee
On Wed, Nov 12, 2014 at 11:42 AM, Edward Armes 
wrote:

> HI guys,
>
> Thanks for your responses, they have indeed answered all my questions
> pretty much as I was mainly looking for information on how to modify how
> Django accesses it's ORM layer. However from your answer it seems that it
> would be better that I do it at the model layer. I apologize for being so
> vague in my question it was semi-deliberate as I wanted to avoid people
> posting application specific solutions like "Use module X and do Y" and
> often when you ask questions reguarding internals on open-source projects
> and other places (i.e. Stack Overflow) you normaly get a load people
> responding with "why?" which for understandable reasons I wanted to avoid.
>
> To follow on from this I have a few more quick questions:-
>
> - If my understanding is correct the Django admin interface uses the model
> layer? If so while learning Django I remember reading (although I can't
> find the link now) that if you use a model that doesn't use Django database
> layer the admin code doesn't work? if this is the case why so?
>

Yes with an if, no with a but :-)

Out of the box, Django's admin only works with Django models. This is
because most of what the admin is doing is based around model introspection
- it's not making database calls per se, it's using the fact that you've
registered your "Product" model, and a Django model has internal mechanisms
to answer questions like "what fields do you have, and what type are those
fields". From that, Django Admin can build a basic CRUD workflow around the
model.

If your data store *isn't* a Django model, then Django's admin doesn't have
any metadata about the model to work with, so it doesn't have any way to
build that workflow.

That said - one of the driving forces behind the Meta Refactor that I
referenced was to formalize what that metadata interface actually is, so in
principle, *any* data model could be displayed in Django's admin, as long
as it is self-describing in the way the Django admin is expecting. As a
proof of concept of this Daniel (the GSoC student responsible) built a
wrapper that lets you browse your Gmail inbox in Django's admin - after
all, email is just a bunch of models like Message, Thread, Folder etc, and
there's an API for manipulating them. That API doesn't use a database, but
it does do Create, retrieve, update and delete, so Django's admin can be
used as a visualisation for it.


> - Secondly would I be correct in thinking that by having asynchronous
> models it would break the default forms and views lthat are included ike
> the wonderful Admin package?
>

Again - only "out of the box". If you make it quack like a Django-shaped
duck by providing an interface that is compatible with Django's
expectations, then it *should* work, and the Meta refactor that is
hopefully coming for 1.8 should make this a lot easier.

Yours,
Russ Magee %-)

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


Re: form mixin for modelform ?

2014-11-13 Thread James Schneider
Modify your Meta class to include the extra fields on the model form. The
Meta classes are not inherited.

You may also need to override the save() method on your model form to
actually save the contents of those extra fields in the inherited form.

-James
On Nov 13, 2014 6:32 PM, "Michael"  wrote:

> Hi,
>
> Why does the following not give a final model form with 3 fields?
> The two extra fields are not available. If I move them directly into the
> model form, it works but I wanted to declare these fields in a separate
> form because I plan on reusing them in several forms.
> Is there a way to do that?
>
> class FormA(forms.Form):
> extra_field_1 = forms.CharField(required=False)
> extra_field_2 = forms.CharField(required=False)
>
> class ModelFormA(FormA, forms.ModelForm):
> class Meta:
> model = ModelA
> fields = ['email']
>
> Thanks
> Mike
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/53753989-9f3b-4a46-b96a-5edf7d7ccd69%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%2BciW0NwTDLRKZH9D5nPOCQfbqpen6ng_EH24B6bJ6d-xdUA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: set the css class of a form widget based on the data

2014-11-13 Thread Russell Keith-Magee
Hi Michael,

The best bet would be to write a custom widget, and override the render()
method. render() takes the name of the widget, the value to render, and a
dictionary of attr values. In your subclass, you can override this method
to inject the additional attributes based on the provided value - something
like:

class MyWidget(TextInput):
def render(self, name, value, attrs=None):
if value == SPECIAL VALUE:
attrs['class'] = 'class1 class2'
return super(MyWidget, self).render(name, value, attrs)

This is an oversimplification - there's a few extra edge cases you'll need
to account for - if attrs is none, or if 'class' already exists - but the
idea should hopefully make sense.

Yours,
Russ Magee %-)



On Wed, Nov 12, 2014 at 9:25 PM, Michael 
wrote:

> Hi,
>
> The ``attrs`` attribute of a widget allows to define the html attributes.
> For example, setting it to ``widget.attrs['class'] = 'class1 class2'`` will
> add ``class="class1 class2"`` on the rendered widget.
>
> However, how can I set them based on the data? I display an update form
> and I'd like to change the CSS class based on the data that is going to be
> displayed when the form is rendered.
>
> Where could I check for the data in order to change the ``attrs`` property
> of the widget before it is rendered?
>
> 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/3569acd7-5bec-4df9-8960-4952b3fee8fb%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/CAJxq849qJkr6GrqK-6FQ7phpgAAR%3Dk3c_0CWNsv%3DyuJy9rXWzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using two urls to load the same template

2014-11-13 Thread 'werefrog' via Django users

Hello Kyle,

I have no clue of what's happening at your Home object request but you 
have two urls sharing the same name. You can allow the two urls in the 
same pattern like this:


url(r'^(index\.html/)?$', views.index, name='index'),

Here, the group (index\.html/) can be found once or not at all thanks to 
the '?'.


Best Regards,
M

Le 14/11/2014 05:33, RLF_UNIQUE a écrit :

Did some more testing, seems like it's completely skipping the views.py,
and going straight to loading index.html, any way to force it to
dynamically load?

On Thursday, November 13, 2014 9:37:27 PM UTC-6, RLF_UNIQUE wrote:

Hello,

I'm having this weird situation where if you go to my website like this
www.mywebsite.com
vs like this
www.mywebsite.com/index.html

I'm getting different values.

*urls.py*
urlpatterns += patterns('',
   url(r'^index.html$',   views.index,
name='index'),
   url(r'^$',  views.index,
name='index'),
)

*view.py*
def index(request):
home_list = Home.objects.all()[:1]
 
 

context = {'home_list': home_list}

return render_to_response('index.html', context)

*index.html*
{% extends 'base.html' %}
 
 
   
   {% block content %}

   test
   {% for home in home_list %}
   {{home.description|safe}}
   {% endfor %}
   {% endblock %}

when I just go to mysite.com, I only get "test", whereas when I go to
mysite.com/index.html, I get "test" as well as the home variable.

It almost seems like something isn't loading in the proper order?

Thanks
Kyle



--
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/546591FC.5060002%40yahoo.fr.
For more options, visit https://groups.google.com/d/optout.


Re: Using two urls to load the same template

2014-11-13 Thread RLF_UNIQUE
I think I figured it out. I was building "in" satchmo and was previously 
appending my urls to satchmo s, which probably has a catch all handler (r'^$') 
already that was loading it's own view and rendering index.html but was hitting 
my (overridden) template without any context since the views handler was 
different

-- 
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/bbd2356e-ae3d-4ba2-82a9-8877f9625a6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using two urls to load the same template

2014-11-13 Thread RLF_UNIQUE
Did some more testing, seems like it's completely skipping the views.py, 
and going straight to loading index.html, any way to force it to 
dynamically load?

On Thursday, November 13, 2014 9:37:27 PM UTC-6, RLF_UNIQUE wrote:
>
> Hello,
>
> I'm having this weird situation where if you go to my website like this
> www.mywebsite.com
> vs like this
> www.mywebsite.com/index.html
>
> I'm getting different values.
>
> *urls.py*
> urlpatterns += patterns('',   
>   url(r'^index.html$',   views.index,   
> name='index'),
>   url(r'^$',  views.index,   
> name='index'),
> )
>
> *view.py*
> def index(request):
>home_list = Home.objects.all()[:1] 
> 
> 
>
>context = {'home_list': home_list}
>return render_to_response('index.html', context)
>
> *index.html*
> {% extends 'base.html' %} 
> 
> 
>   
>   {% block content %}
>   test
>   {% for home in home_list %}
>   {{home.description|safe}}
>   {% endfor %}
>   {% endblock %}
>
> when I just go to mysite.com, I only get "test", whereas when I go to 
> mysite.com/index.html, I get "test" as well as the home variable.
>
> It almost seems like something isn't loading in the proper order?
>
> Thanks
> Kyle
>

-- 
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/66e05589-6e70-4fea-9060-70dab7f6fefb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Using two urls to load the same template

2014-11-13 Thread RLF_UNIQUE
Hello,

I'm having this weird situation where if you go to my website like this
www.mywebsite.com
vs like this
www.mywebsite.com/index.html

I'm getting different values.

*urls.py*
urlpatterns += patterns('',   
  url(r'^index.html$',   views.index,   
name='index'),
  url(r'^$',  views.index,   
name='index'),
)

*view.py*
def index(request):
   home_list = Home.objects.all()[:1]   


 
   context = {'home_list': home_list}
   return render_to_response('index.html', context)

*index.html*
{% extends 'base.html' %}   



  {% block content %}
  test
  {% for home in home_list %}
  {{home.description|safe}}
  {% endfor %}
  {% endblock %}

when I just go to mysite.com, I only get "test", whereas when I go to 
mysite.com/index.html, I get "test" as well as the home variable.

It almost seems like something isn't loading in the proper order?

Thanks
Kyle

-- 
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/4ec40b5b-99a3-43d5-bfd8-d245fb61ccd1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is django framework feasible for developing online LMS?

2014-11-13 Thread Pradip Shahi

>
> Thanx Ari Davidow,
>
Can a new learning management  system be developed using edx framework. 

-- 
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/aacbe2a7-46c7-41d7-b302-7f190f9537b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


form mixin for modelform ?

2014-11-13 Thread Michael
Hi,

Why does the following not give a final model form with 3 fields?
The two extra fields are not available. If I move them directly into the 
model form, it works but I wanted to declare these fields in a separate 
form because I plan on reusing them in several forms.
Is there a way to do that?

class FormA(forms.Form):
extra_field_1 = forms.CharField(required=False)
extra_field_2 = forms.CharField(required=False)

class ModelFormA(FormA, forms.ModelForm):
class Meta:
model = ModelA
fields = ['email']

Thanks
Mike

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


Re: Chrome Desktop Notification for Django

2014-11-13 Thread Max Nathaniel Ho
HI Collin,

Thanks for pointing that out. Apart from the documentation, do you have any
examples of how to implement it?

Thank you.

On Thu, Nov 13, 2014 at 5:55 AM, Collin Anderson 
wrote:

> Hello,
>
> From a front-end standpoint, I personally like EventSource for this,
> though you could also use websockets or polling (checking every few
> minutes/seconds).
>
> https://developer.mozilla.org/en-US/docs/Web/API/EventSource
> http://en.wikipedia.org/wiki/Server-sent_events
>
> Collin
>
> On Tuesday, November 11, 2014 8:12:43 PM UTC-5, Max Nathaniel Ho wrote:
>>
>> I found this excellent example on Chrome Desktop Notification - Chrome
>> desktop notification example?
>> 
>>
>> I am able to create the Desktop Notification by clicking a button.
>>
>> However, that is pretty front-end.
>>
>> I would like to find out how to link an event in the web app. For
>> example,  the event could be someone posting a job for a freelance work.
>> And user who is logged into the web app but not actively browsing on the
>> web page will be notified via the Chrome Desktop Notification.
>>
>> Are there any examples of how I can create a Event Handler to listen to
>> data in the backend, and prompt the user via the Desktop Notification?
>>
>> Many thanks!
>>
>  --
> 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/64rg0i9ChyY/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/c162fe08-81fa-4a25-aa55-30bd2821ce2b%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Regards,
Max Nathaniel Ho.

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


Re: custom query app

2014-11-13 Thread C. Kirby
Hi John,
I built an app that basically lets you create an advanced search against a 
model (or related models).
I am using it in production on two different applications. If you use it I 
would be happy to have feedback.

You can find it here: 
https://github.com/ckirby/django-modelqueryform

Kirby

On Thursday, November 13, 2014 1:34:33 PM UTC-6, John Schmitt wrote:
>
> I have a big django project with multiple apps, models, and the models 
> have quite a few fields. 
>
> A request came that asked for a page that allows the user to pick and 
> choose from the various fields to create their own query. 
>
> Does any precedent for this exist? 
>
> If I may use a car analogy, a django project that stores info on cars 
> complete with many types of engines, car models, interiors, entertainment 
> systems, and trim features.  Could I create an app where a user could 
> arbitrarily pick and choose fields from each of those models to perform a 
> query on their web browser?  One customer could search for cars with V8 
> engines and DVD players and a different customer could search for cars with 
> nylon interiors, no entertainment systems and manufactured between dateA 
> and dateB.  The key thing is that the customer gets to browse for the 
> available attricutes and add them to their query. 
>
> The most obvious would be create an app that fixed every possible field 
> and appropriate form for each field.  When a model changes and a new field 
> is added, simply add another field to this query app.   This is what real 
> estate sites seem to do.  I'd like to think there's a more general and 
> elegant way to do this.  Is there a general purpose field chooser? 
>
> At first I thought that this project would be a good starting point, 
> because he kind of implements spreadsheet: 
>
> https://github.com/tmu/dimtable 
>
> I'm not sure how I can map my problem to that potential solution. 
>
> Discussion and wild-eyed ideas welcome. 
>
> John 
>

-- 
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/ee626ec1-f217-4b92-bc8c-a9c860ffb9ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Uploadfile form and CSS Style

2014-11-13 Thread James Schneider
If you are manually expressing the form, then you can add classes and ID's
to any or all elements in the form. Even if you are using something like
the {{ form.as_p }} method to display the form, you can still style it
using CSS styles at the tag level. Just include a custom CSS file with your
template.

-James
On Nov 13, 2014 12:13 PM, "Russo"  wrote:

>  Hi Kakar,
>
> but i tried and there is not way to change the bottom style, see the html
> code
>
> 
>  enctype="multipart/form-data">
> {% csrf_token %}
>
> {{ form.non_field_errors }}
> {{ form.docfile.label_tag }} {{ form.docfile.help_text
> }}
> 
> {{ form.docfile.errors }}
> {{ form.docfile }}
> 
> 
> 
>
> as it is a form there is no way to change style ¿?
>
> Regards/AR
>
>
> El 13/11/2014 a las 03:37 p.m., Kakar Nyori escribió:
>
> Then you need to apply css to the form.
>
> On Fri, Nov 14, 2014 at 1:16 AM, Russo 
> wrote:
>
>> Hi,
>>
>> i just implemented the uploadfile form on Django, and everything goes
>> greate, but i would like to do if it is possible to apply CSS styles to the
>> upload botton on the forms, Anybody knows this?
>>
>> Regards
>> Russo
>>
>> --
>> 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/54650A9B.8040004%40musicparticles.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%2B8oko%2Bawro-H19b7XG-LXnNc4r%2BmFX0qTx_7kkvSmo%3Dvkg30A%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/5465119E.2030707%40musicparticles.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%2BciVJek%2B_qxrqM5uqMFc0JZq1FEPK4waKtq%3DLOfK90JPN7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Uploadfile form and CSS Style

2014-11-13 Thread Russo

Hi Kakar,

but i tried and there is not way to change the bottom style, see the 
html code



enctype="multipart/form-data">

{% csrf_token %}

{{ form.non_field_errors }}
{{ form.docfile.label_tag }} {{ form.docfile.help_text 
}}


{{ form.docfile.errors }}
{{ form.docfile }}




as it is a form there is no way to change style ¿?

Regards/AR


El 13/11/2014 a las 03:37 p.m., Kakar Nyori escribió:

Then you need to apply css to the form.

On Fri, Nov 14, 2014 at 1:16 AM, Russo > wrote:


Hi,

i just implemented the uploadfile form on Django, and everything
goes greate, but i would like to do if it is possible to apply CSS
styles to the upload botton on the forms, Anybody knows this?

Regards
Russo

-- 
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/54650A9B.8040004%40musicparticles.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%2B8oko%2Bawro-H19b7XG-LXnNc4r%2BmFX0qTx_7kkvSmo%3Dvkg30A%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/5465119E.2030707%40musicparticles.com.
For more options, visit https://groups.google.com/d/optout.


Re: custom query app

2014-11-13 Thread Clifford Ilkay
On 11/13/2014 02:33 PM, John Schmitt wrote:
> I have a big django project with multiple apps, models, and the models have 
> quite a few fields.
>
> A request came that asked for a page that allows the user to pick and choose 
> from the various fields to create their own query.
>
> Does any precedent for this exist?

Hi John,

What you're looking for is called "faceted search" or "faceted
navigation". Django Haystack
 is one
implementation of this.

-- 
Regards,

Clifford Ilkay

-- 
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/54650FA1.7080600%40dinamis.com.
For more options, visit https://groups.google.com/d/optout.


Re: Uploadfile form and CSS Style

2014-11-13 Thread Kakar Nyori
Then you need to apply css to the form.

On Fri, Nov 14, 2014 at 1:16 AM, Russo  wrote:

> Hi,
>
> i just implemented the uploadfile form on Django, and everything goes
> greate, but i would like to do if it is possible to apply CSS styles to the
> upload botton on the forms, Anybody knows this?
>
> Regards
> Russo
>
> --
> 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/54650A9B.8040004%40musicparticles.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%2B8oko%2Bawro-H19b7XG-LXnNc4r%2BmFX0qTx_7kkvSmo%3Dvkg30A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Uploadfile form and CSS Style

2014-11-13 Thread Russo

Hi,

i just implemented the uploadfile form on Django, and everything goes 
greate, but i would like to do if it is possible to apply CSS styles to 
the upload botton on the forms, Anybody knows this?


Regards
Russo

--
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/54650A9B.8040004%40musicparticles.com.
For more options, visit https://groups.google.com/d/optout.


custom query app

2014-11-13 Thread John Schmitt
I have a big django project with multiple apps, models, and the models have 
quite a few fields.

A request came that asked for a page that allows the user to pick and choose 
from the various fields to create their own query.

Does any precedent for this exist?

If I may use a car analogy, a django project that stores info on cars complete 
with many types of engines, car models, interiors, entertainment systems, and 
trim features.  Could I create an app where a user could arbitrarily pick and 
choose fields from each of those models to perform a query on their web 
browser?  One customer could search for cars with V8 engines and DVD players 
and a different customer could search for cars with nylon interiors, no 
entertainment systems and manufactured between dateA and dateB.  The key thing 
is that the customer gets to browse for the available attricutes and add them 
to their query.

The most obvious would be create an app that fixed every possible field and 
appropriate form for each field.  When a model changes and a new field is 
added, simply add another field to this query app.   This is what real estate 
sites seem to do.  I'd like to think there's a more general and elegant way to 
do this.  Is there a general purpose field chooser?

At first I thought that this project would be a good starting point, because he 
kind of implements spreadsheet:

https://github.com/tmu/dimtable

I'm not sure how I can map my problem to that potential solution.

Discussion and wild-eyed ideas welcome.

John

-- 
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/20141113193356.GA22840%40mediapc.snapdragonfly.net.
For more options, visit https://groups.google.com/d/optout.


Re: need precise advice before final decision on Django

2014-11-13 Thread Krishnakant Mane

On 11/14/2014 12:07 AM, Avraham Serour wrote:

Now, I wish to know, if I can use the template's capacity of generating

good forms and add good css without having a compulsion of using the model
part of Django?
yes.

Any good article, blog or tutorial for this?

Happy hacking.
Krishnakant.

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


Re: need precise advice before final decision on Django

2014-11-13 Thread Krishnakant Mane


Hi Javier,
On 11/14/2014 12:21 AM, Javier Guerra Giraldez wrote:

On Thu, Nov 13, 2014 at 1:32 PM, Krishnakant Mane  wrote:

I guess it is obvious that I only need the view and template part here.


and forms.   they're often used with models (i.e. subclassing
ModelForm), but that's not a requirement.

Yes correct, I just found this thread on stackoverflow
http://stackoverflow.com/questions/17754295/can-i-have-a-django-form-without-model
I see this is a wonderful thing.
I had thought of a similar idea and was just looking for the right 
direction.





also note that doing XMLRPC calls in view code will block the
request/response cycle.  in principle that would mean you need a good
multithreading WSGI container, but maybe some good
event-driven-monkeypatching platform can work too.


Well, I had used Pylons for some time and I did make xmlrpc calls 
correctly and I used to have no problems in having multiple requests 
going to the rpc server at one point from different clients.

So I don't think the Django views may be so stupid either.
Happy hacking.
Krishnakant.

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


Re: need precise advice before final decision on Django

2014-11-13 Thread Javier Guerra Giraldez
On Thu, Nov 13, 2014 at 1:32 PM, Krishnakant Mane  wrote:
> I guess it is obvious that I only need the view and template part here.


and forms.   they're often used with models (i.e. subclassing
ModelForm), but that's not a requirement.


also note that doing XMLRPC calls in view code will block the
request/response cycle.  in principle that would mean you need a good
multithreading WSGI container, but maybe some good
event-driven-monkeypatching platform can work too.


-- 
Javier

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


Re: Using Django with Gulp.js

2014-11-13 Thread Cal Leeming [iops.io]
Personally I use a mixture of Vagrant, Docker, Gulp and makefiles to
automate the entire process.

You run the gulp process as a backgrounded job, and then the django
runserver in the foreground.. of course, this means gulp is then not
interactive.. if you want both to be inter, then you have to use two
separate shells, or you can use a tmux script to make it pretty.

You could either keep your static files inside the static dir then build to
a sub dir, then upon release you would remove all but the subdir, but this
is of course a bit hacky. You can instead keep the static files out of the
static dir, and only build out to that dir instead. You do not want to be
committing compiled js/css, so you should automate this entire process as
part of your CI deployment. You can use something like CircleCI and Docker
Hub to automate this.

Pro tip - don't attempt to make all this work automagically with
django-pipeline or other tools, it will end in tears. I literally spent
over a month prototyping many different workflows, and I'm still not 100%
happy with the end outcome. Remember that this can quickly turn into a
rabbit hole, and also remember that both Gulp and Grunt have *serious*
performance issues with larger file counts (100% cpu when using default
settings). I haven't found a single article that has a workflow which has
done it "correctly", and even my own has problems... if you have a week of
time to sink, then prototype your heart out... otherwise, just do whatever
gets the job done.

As for linking to the concat/minified versions, you'd just use
settings.DEBUG in your template and link to .min.css if DEBUG is true,
there's no need to use HTML libraries, I'm not sure what your reasoning
behind that was. Remember that depending on your level of minification, it
might break your source or cause weirdness, so you should always run tests
against your minified version as part of your CI build.  Another thing to
remember, both Gulp/Grunt do not gracefully handle parser errors by
default, so you could end up with your build process exiting but the run
server still going. I have seen some people that spawn a process from
runserver, but this is particularly nasty imho.

I'm actually due to be doing a video about the way that we do it here, but
it's unlikely to be released for another month.

Hope this helps

Cal

PS) You should consider using your real name, or at least an alias, for
friendly/public mailing lists like this one. This isn't full-disclosure :)

On Thu, Nov 13, 2014 at 9:29 AM, Some Developer 
wrote:

> I'm using Gulp.js to deal with my JavaScript and SASS files to concatenate
> them and minify them but I'm unsure how to merge it with my Django
> workflow. I want to be able to automatically minify the files into one big
> JavaScript and CSS file to reduce HTTP requests and to allow easy uploading
> to a CDN but I need to be able to edit to my base template so that the
> development version (which links to the files individually) can change to
> linking to the big concatenated files. I was thinking about writing a
> simple parser that does the changes automatically but am unsure what the
> best method to use is.
>
> Should I use a Python HTML library to edit the HTML file or should I use
> regular expressions to do the simple text replacement? I should be able to
> call the Python script from a Gulp task to do the actual editing. I'd also
> want to change the values back when I move back to the development version
> of my site.
>
> Any help is appreciated.
>
> --
> 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/546479DD.6010407%40googlemail.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/CAHKQagGzwL%2BSA8TZyScRrcF8V1v9qn9ta1aW4Od%3DOsXP-U%3DiaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: need precise advice before final decision on Django

2014-11-13 Thread Avraham Serour
> Now, I wish to know, if I can use the template's capacity of generating
good forms and add good css without having a compulsion of using the model
part of Django?
yes.

On Thu, Nov 13, 2014 at 8:32 PM, Krishnakant Mane  wrote:

> Hello all,
> I did look at a few good tutorials and also did some hands-on with what
> ever those tutorials had to offer.
> Also did some of my own inovations with the tutorials/
> I feel Django has greatly impressed me so far.
> Now I think I can rightly ask my question and in a more specific way.
> I would like to have all the bennifits of one particular aspect of Django,
> namely it's ability to create very good looking forms, playing with divs in
> templates.
> All in all, I think if it is going to be more Python and less writing of
> HTML and CSS I love it.
> My Specific question is about this very aspect.
> I am developing a accounting. book keeping software.
> As I had previously emailed to this list, I have the complete logic
> written in an xmlrpc package coded using Twisted.
> Now, I wish to know, if I can use the template's capacity of generating
> good forms and add good css without having a compulsion of using the model
> part of Django?
> I guess it is obvious that I only need the view and template part here.
> I feel if Python can hellp me with writing good looking forms and if there
> are ways I can easily use AJAX then I am going with it.
> So this is the only doubt remaining in my mind.
> And yes, I really don't need the admin part, so far as I can see it.
> Regards.
> Krishnaaknt.
>
> --
> 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/5464F94A.8010701%40gmail.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/CAFWa6tKousU48px%2Bp1HX%2BMdN%2BJs8JMJk9bjeyBsk0sV%3DjSukzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


need precise advice before final decision on Django

2014-11-13 Thread Krishnakant Mane

Hello all,
I did look at a few good tutorials and also did some hands-on with what 
ever those tutorials had to offer.

Also did some of my own inovations with the tutorials/
I feel Django has greatly impressed me so far.
Now I think I can rightly ask my question and in a more specific way.
I would like to have all the bennifits of one particular aspect of 
Django, namely it's ability to create very good looking forms, playing 
with divs in templates.
All in all, I think if it is going to be more Python and less writing of 
HTML and CSS I love it.

My Specific question is about this very aspect.
I am developing a accounting. book keeping software.
As I had previously emailed to this list, I have the complete logic 
written in an xmlrpc package coded using Twisted.
Now, I wish to know, if I can use the template's capacity of generating 
good forms and add good css without having a compulsion of using the 
model part of Django?

I guess it is obvious that I only need the view and template part here.
I feel if Python can hellp me with writing good looking forms and if 
there are ways I can easily use AJAX then I am going with it.

So this is the only doubt remaining in my mind.
And yes, I really don't need the admin part, so far as I can see it.
Regards.
Krishnaaknt.

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


Re: HStoreField can't adapt type 'dict'

2014-11-13 Thread Fred Stluka

Collin,

Your answers to so many questions lately have been very
helpful.  Thanks!

Any reason you don't include the original question with your
reply?  Either by top-posting, or by quoting an excerpt?

Would provide context to your answers, making them more
useful, especially to those of us reading them as email, not
at the Google Groups Web site.

Thanks!
--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 11/12/14 3:36 PM, Collin Anderson wrote:

If anyone runs into this later, here's the ticket with the solution:
https://code.djangoproject.com/ticket/23776
--
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/fa827df7-abc4-41f6-b0b7-b947b2638396%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/5464DC53.2070706%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


null value in column "geom" violates not-null constraint

2014-11-13 Thread elcaiaimar
Hello everybody, I'm working with django and geodjango and now I have a 
problem with the geometry. I want that users can introduce coordinates in a 
form and then, these are saved in a database (postgis).

Now, I can save X and Y coordinates, but the geom field doesn't work and I 
don't know why.

In my models.py I have create the next class:

from django.contrib.gis.db import models
class Pozo(models.Model):
# gid_pozo = models.IntegerField(primary_key=True)
# gid_colector = models.ForeignKey(Colector)
coorx = models.IntegerField()
coory = models.IntegerField()
geom = models.PointField()
objects = models.GeoManager()

When I introduce coordinates, I get this error: 

null value in column "geom" violates not-null constraint
DETAIL:  Failing row contains (7, -1, 1, null).

7 = id, -1, 1 =coordinates, null=geom


What I can solve this trouble?

Thank you very much!

-- 
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/ec67c578-f073-4845-822f-5684d0174db7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Problem emailing CSV file that was read as a binary file

2014-11-13 Thread Joshua Fialkoff
Hi all,

I have this function that helps send emails with attachments:

def send_email(…):
…
msg = EmailMessage(
subject, body, send_from,
recipients_list, cc=cc, bcc=bcc,
headers={'Reply-To': reply_to})
msg.attach_alternative(html_body, "text/html")
for f in files:
try:
email_fn, path = f
except (ValueError, TypeError):
path = f
_, email_fn = os.path.split(path)
with open(path, 'rb') as f:
contents = f.read()
msg.attach(email_fn, contents)

msg.send()


In the case where path points to a file with a text mimetype (e.g., 
'text/csv'), this fails with this error:

AttributeError: 'bytes' object has no attribute 'encode'

Here's an excerpt from django.core.mail.message. The error occurs on the 
line 4.

basetype, subtype = mimetype.split('/', 1)
if basetype == 'text':
encoding = self.encoding or settings.DEFAULT_CHARSET
attachment = SafeMIMEText(content, subtype, encoding)
elif basetype == 'message' and subtype == 'rfc822':
# Bug #18967: per RFC2046 s5.2.1, message/rfc822 attachments
# must not be base64 encoded.
if isinstance(content, EmailMessage):
# convert content into an email.Message first
content = content.message()
elif not isinstance(content, Message):
# For compatibility with existing code, parse the message
# into an email.Message object if it is not one already.
content = message_from_string(content)

attachment = SafeMIMEMessage(content, subtype)
else:
# Encode non-text attachments with base64.
attachment = MIMEBase(basetype, subtype)
attachment.set_payload(content)
Encoders.encode_base64(attachment)
return attachment

My question is, why not use base64 encoding if the attachment content is 
specified as bytes?

-- 
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/e19dd1f5-751d-4136-9923-ecb14cc7052d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django auto fill recipient in Django_messages

2014-11-13 Thread Ronaldo Bahia
Thanks for answering, but it was solve by myself as posted in here:
http://stackoverflow.com/questions/26817483/django-cannot-assign-uusername-message-recipient-must-be-a-user-instanc



*Ronaldo Bahia *
Diretor | JobConvo.com
Tel: 11 3280 6971

2014-11-12 18:57 GMT-02:00 Collin Anderson :

> Hello,
>
> What does your form_class look like?
>
> Thanks,
> Collin
>
>  --
> 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/kt8ZzFSW0-4/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/6997aef4-f9ea-4cf0-8054-04382cc1ff6d%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/CAGz5-6j7Az8yObAiUvoxDxrwF%2Bfu0S-NqDhhXyz_qh%2B%3D8DOv%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Want to change home->blog to Admin home -> blog

2014-11-13 Thread Sachin Tiwari
 Hi All,

 I want to change Home link at admin page to Admin Home -> blog -> ...

 I tried by modifying  base.html and base_site.html in my templates/admin/, 
but it would work

 {% block breadcrumbs %}

{% trans ' Admin Home' %}
{% if title %}  {{ title }}{% endif %}

{% endblock %}
   
   Please help..



-- 
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/6b23665d-1f41-4bb2-a996-68811cb5f925%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django & gunicorn: KeyError with active log-config setting

2014-11-13 Thread Florian Auer
Hi

I wanted to let my gunicorn server to log its config into a dedicated file.
Therefore I added an extra line:
exec ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
--log-level=debug \
--bind=unix:$SOCKFILE \
--log-file=$ERRLOG \
--access-logfile=$LOGFILE \
--log-config=$CONFLOG # added this line with the \ before

But when i start the server with supervisorctl i receive a "KeyError" for 
the formatters.
Traceback (most recent call last):
  File "/webapps/sonar3/tekkoSONAR/../bin/gunicorn", line 11, in 
sys.exit(run())
  File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/app/wsgiapp.py"
, line 74, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/app/base.py", 
line 185, in run
super(Application, self).run()
  File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/app/base.py", 
line 71, in run
Arbiter(self).run()
  File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/arbiter.py", 
line 57, in __init__
self.setup(app)
  File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/arbiter.py", 
line 88, in setup
self.log = self.cfg.logger_class(app.cfg)
  File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/glogging.py", 
line 175, in __init__
self.setup(cfg)
  File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/glogging.py", 
line 203, in setup
disable_existing_loggers=False)
  File "/usr/local/lib/python3.3/logging/config.py", line 70, in fileConfig
formatters = _create_formatters(cp)
  File "/usr/local/lib/python3.3/logging/config.py", line 103, in 
_create_formatters
flist = cp["formatters"]["keys"]
  File "/usr/local/lib/python3.3/configparser.py", line 937, in __getitem__
raise KeyError(key)
KeyError: 'formatters'
- log file exists
- permissions math
Keeping the --log-config out of the command, everything start correctly.

Any help / idea welcome

-- 
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/f186205f-8feb-4d32-8d41-7f41a9b9bfdb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Using Django with Gulp.js

2014-11-13 Thread Some Developer
I'm using Gulp.js to deal with my JavaScript and SASS files to 
concatenate them and minify them but I'm unsure how to merge it with my 
Django workflow. I want to be able to automatically minify the files 
into one big JavaScript and CSS file to reduce HTTP requests and to 
allow easy uploading to a CDN but I need to be able to edit to my base 
template so that the development version (which links to the files 
individually) can change to linking to the big concatenated files. I was 
thinking about writing a simple parser that does the changes 
automatically but am unsure what the best method to use is.


Should I use a Python HTML library to edit the HTML file or should I use 
regular expressions to do the simple text replacement? I should be able 
to call the Python script from a Gulp task to do the actual editing. I'd 
also want to change the values back when I move back to the development 
version of my site.


Any help is appreciated.

--
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/546479DD.6010407%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.