Re: Why are DateTimeField auto_now and auto_now_add bad?

2014-07-27 Thread Russell Keith-Magee
I'm not aware of a formally documented list anywhere.

To the best my knowledge, the bug/downside that is referred to here is that
the fields *won't* automatically update in *every* circumstance. You need
to actually *save* the model to make the field update. Calls to update,
save_base, etc won't invoke the "auto" part of the field logic, and the
timestamp won't be adjusted.

Yours,
Russ Magee %-)


On Sun, Jul 27, 2014 at 10:29 PM, Mattias Linnap  wrote:

> Hi all,
>
> I've seen DateTimeField's auto_now and auto_now_add parameters often
> described as "buggy" or "error-prone". For example:
> https://code.djangoproject.com/ticket/22995
> https://groups.google.com/forum/#!topic/django-developers/TNYxwiXLTlI
>
> The ticket proposes to document these downsides or problems in more
> detail. But until that happens, is there a blog post or mailing list post
> somewhere that summarises the gotchas to watch out for with auto_now?
>
> Thanks,
>
> Mattias
>
> --
> 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/9d61eca2-21c7-41ae-a921-a448d5f9f4f9%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/CAJxq848229xCPoCKQ1KpayYqiTK4Wfr4wascb4h66JwyPGKOdA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Search via Form Redirect to URL

2014-07-27 Thread Conner DiPaolo


I already have a valid search function mapped in my Django project, you 
type in a url '/project/search//' and it responds the corresponding search 
results on a page. I want to have a search box in my nav-bar that was 
created in my base.html and have users type in a query and it will redirect 
them to the search url. When I type into the search bar and click submit, 
however, the I am just directed to '/project/search/' with no relation to 
the query. How do I connect the form to redirect to the URL, *properly*??

Thanks in advance.

Here is my view definition and form class:

class SearchForm(forms.Form):
search_string = forms.CharField(max_length=100)def search(request, 
search_query):
if request.method == 'GET':
form = SearchForm()
context = RequestContext(request)
search_string = search_query.replace('_',' ')
search_terms = search_query.split('_')
search_results = Article.objects.all()
for term in search_terms:
search_results = search_results.filter(article__icontains=term)

context_dict = {
'search_string':search_string,
'search_results':search_results,
'form':form,
}


if request.method == 'POST':
form = SearchForm(request.POST)
if form.is_valid():
search_string = form.data['search_string']
search_query = search_string.replace(' ','_')
###return HttpResponseRedirect(reverse('search', 
args=(search_query,)))
search_url = '/beacon/search/' + search_query + '/'
return HttpResponseRedirect(search_url)
else:
return render_to_response('search.html', context_dict, context)

My base form html is (yes it is from bootstrap):



{% csrf_token %}


Submit


-- 
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/952d7d70-4f65-4283-bcd0-45e4385ae672%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Chat application

2014-07-27 Thread Pedro
Thank you guys.

I tried to do it using socket.io clients and django-socketio but i just
can't make it works. So, now i'm using a node.js server that talks with my
main django server. Clients emit messages to the node.js server, that does
the authentification with a POST request to my django server. I need to do
more tests but this looks to work well.

Thank you all!
Em 20/06/2014 00:22, "Anshum Verma"  escreveu:

> I would suggest you to use Twisted along with Django. Django could serve
> as MVC framework and twisted could take control of connection protocol.
> On Jun 19, 2014 4:17 AM, "Pedro"  wrote:
>
>> Hello,
>>
>> i'm working in a mobile app that depends of a Django server (to manage
>> user data and stuff).
>> This mobile app is about a social network with users interacting. It
>> should have a chat system, where two or more users can send and receive
>> messages and photos.
>>
>> I'm thinking in the best way to implement the communication and the model
>> on the server. My first idea is to use a simple model with rooms and
>> messages (each message belong to a room). To send messages from a client to
>> the server, i think i could use http requests, like GETs and POSTs, where i
>> would implement syncronization methods and stuff.
>>
>> Is this the best approach to solve this problem on Django?
>>
>>
>> --
>> Pedro Alves
>>
>> *Mestrando em Ciência da Computação*
>> *Universidade Estadual de Campinas*
>>
>> --
>> 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/CACW_pa0Dfom4Eydop5qedMMP5fbuBx-yZAUgDrhDApfewDFWbQ%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/CAMPe4x1g-WKZhbbq_Eo_p--DBZq5hqHU3i1ETM0Bwx-fFeQ4sQ%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/CACW_pa2Tbm3f3sNndQxa2AEtazMGP9zsdeD4UkJw7nnnDrKmUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: inicio en django

2014-07-27 Thread Mario R. Osorio
No se si te mencione virtualenvwrapper que, aunque no es imperativo, te va 
a facilitar mucho la vida.



On Saturday, July 26, 2014 4:10:37 PM UTC-4, juantonio v wrote:
>
> hola tengo el Django-1.6.5.tar.gz de django, ahora como lo instalo?
>
>
> gracias!
>

-- 
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/cc1af56d-4a1e-4df8-9bef-146f269130a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: inicio en django

2014-07-27 Thread Mario R. Osorio
En primer lugar, no hace falta que vayas a pagar ningun curso de $95, eso 
es pura mierda. Especialmente habiendo TANTOS RECURSOS GRATIS sobre django 
en toda la internet. Por supuesto que el 80% quizas sea en ingles.

Desconozco tu experiencia, pero antes de comenzar a trabajar con django, es 
casi imperativo que aprendas a usar usar virtualenv, pip e easy_install.

Te envio algunos enlaces de interes para que te inicies:

   - Creación de entornos virtuales Python 
   

   - Cómo instalar un paquete Python con pip 
   
   - Configurar Django y MySQL en VirtualEnv 
   

   - Virtualenv 
   
   - Virtualenv: Aislando Nuestro Entorno Python 
   
   - Curso Django: Instalación y primera aplicación 
   

   - ¡Descubre Django! 
   - Tu primera aplicación Django, parte 1 
   
   - Empezando con Django 
   - Aprende DJango de Python desde cero 
   
   - 
   - Python Dominicana 006 - python.do, mezzanine y django 
   




On Saturday, July 26, 2014 4:10:37 PM UTC-4, juantonio v wrote:
>
> hola tengo el Django-1.6.5.tar.gz de django, ahora como lo instalo?
>
>
> gracias!
>

-- 
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/c905a2f1-b3e5-4f8d-a46b-320ac44705e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem in the Tutorial 01

2014-07-27 Thread Ricardo Daniel Quiroga
get() si no existe coincidencia te tira error asi de simple.


2014-07-24 11:41 GMT-03:00 Daniel Roseman :

> On Thursday, 24 July 2014 13:53:54 UTC+1, Fabian Zentner wrote:
>
>> Hey guys,
>>
>> I'm new with Django and Python as well. I'm doing the tutorial 1 on the
>> website (https://docs.djangoproject.com/en/1.6/intro/tutorial01/).
>> I'm using Python27 (C:\Python27)
>> In C:\Python27\Scripts\ I have the project mysite and polls like in the
>> tutorial
>>
>> In the part "Playing with the API"
>>
>>
>> **
>>
>
>
>>
>>
>>
>>
>>
>> *>>> p.choice_set.all() [, > object>, , , > object>, ] >>> p.choice_set.count() 6 *
>> I get always Poll: Poll object or Choice: Choice object instead of the
>> defined text. Also I have problems with the part of
>>
>>
>>
>> * p = Poll.objects.get(pk=1) >>> p.was_published_recently() *
>> Could somebody help me please? Before I start with the tutorial number
>> 2...
>>
>> Thanks a lot.
>>
>> Fabian
>>
>
>
> After you make changes to the code,  you need to reload it: the easiest
> way is exit your shell and go back in.
> --
> DR.
>
> --
> 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/d80dc547-6194-4398-81d9-e93db01ca9cf%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Ricardo Daniel Quiroga - L2Radamanthys

   Msn: l2radamant...@gmail.com
   ricardo_q...@hotmail.com

   Email: l2radamant...@gmail.com
   l2radamant...@saltalug.org.ar
   ricardoquiroga@gmail.com

   sitio Web: http://www.l2radamanthys.com.ar
   http://github.com/L2Radamanthys

   Facebook: http://es-la.facebook.com/L2Radamanthys
   Twitter:@l2Radamanthys
-

-- 
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/CAO2-wHZs4Zh2B2RgS%2BSfrDZLLHSUZ00tD37nFEFB-Ou1%3DB1swA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Why are DateTimeField auto_now and auto_now_add bad?

2014-07-27 Thread Mattias Linnap
Hi all,

I've seen DateTimeField's auto_now and auto_now_add parameters often 
described as "buggy" or "error-prone". For example:
https://code.djangoproject.com/ticket/22995
https://groups.google.com/forum/#!topic/django-developers/TNYxwiXLTlI

The ticket proposes to document these downsides or problems in more detail. 
But until that happens, is there a blog post or mailing list post somewhere 
that summarises the gotchas to watch out for with auto_now?

Thanks,

Mattias

-- 
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/9d61eca2-21c7-41ae-a921-a448d5f9f4f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANNOUNCE] Django 1.7 RC 2 released

2014-07-27 Thread James Bennett
Check out the weblog for details (including information on a change to the
keys used to sign Django releases):

https://www.djangoproject.com/weblog/2014/jul/27/17rc2/

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


Re: Django/Python-ldap Ldap Question Adding Entries

2014-07-27 Thread Paul J Stevens
Does ou=Enki Users,dc=enki,dc=local actually exist already?

If it doesn't you need to create it first before trying to add objects
to it.


On 23-07-14 19:05, G Z wrote:
> I'm trying to add entries via a form post in django, I have the
> following code and its really not django specific but it is python-ldap
> specific.
> 
> 
> I'm trying to add entries with python ldap. I'm getting a naming
> convention error. My code is
> 
> import ldap 
> import ldap.modlist as modlist
> 
> LOGIN = "" 
> PASSWORD = '' 
> LDAP_URL = "ldap://127.0.0.1:389; 
> user='grant'
> l = ldap.initialize(LDAP_URL) 
> l.bind(LOGIN, PASSWORD) 
> dn="ou=Enki Users,dc=enki,dc=local" 
> 
> attrs = {}
> attrs['objectclass'] =
> ['top','organizationalRole','simpleSecurityObject']
> attrs['cn'] = 'test'
> attrs['userPassword'] = 'test'
> attrs['description'] = 'User object for replication using slurpd'
> 
> # Convert our dict to nice syntax for the add-function using
> modlist-module
> ldif = modlist.addModlist(attrs)
> 
> # Do the actual synchronous add-operation to the ldapserver
> l.add_s(dn,ldif)
> 
> # Its nice to the server to disconnect and free resources when done
> l.unbind_s()
> 
> The error is:
> 
> ldap.NAMING_VIOLATION: {'info': "2099: NameErr: DSID-0305109C,
> problem 2005 (NAMING_VIOLATION), data 0, best match
> of:\n\t'dc=enki,dc=local'\n", 'desc': 'Naming violation'}
> 
> 
> 
> The code that runs but doesn't insert the user into the correc
> organizational unit is the following code. However even though it runs I
> can't find the user in active directory. Please help me find whats
> wrong. I'm basically making a django webform for user management.
> 
> import ldap 
> import ldap.modlist as modlist
> 
> LOGIN = "" 
> PASSWORD = '' 
> LDAP_URL = "ldap://127.0.0.1:389; 
> user='grant'
> l = ldap.initialize(LDAP_URL) 
> l.bind(LOGIN, PASSWORD) 
> 
> dn="cn=test,ou=Enki Users,dc=enki,dc=local" 
> 
> attrs = {}
> attrs['objectclass'] =
> ['top','organizationalRole','simpleSecurityObject']
> attrs['cn'] = 'test'
> attrs['userPassword'] = 'test'
> attrs['description'] = 'User object for replication using slurpd'
> 
> # Convert our dict to nice syntax for the add-function using
> modlist-module
> ldif = modlist.addModlist(attrs)
> 
> # Do the actual synchronous add-operation to the ldapserver
> l.add_s(dn,ldif)
> 
> # Its nice to the server to disconnect and free resources when done
> l.unbind_s()
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com
> .
> To post to this group, send email to django-users@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a2400449-3f68-4f9c-9d8e-b2d94d0d69f5%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.

-- 

Paul J Stevens   pjstevns @ gmail, twitter, github, linkedin
   www.nfg.nl/i...@nfg.nl/+31.85.877.99.97

-- 
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/53D4F11C.90907%40nfg.nl.
For more options, visit https://groups.google.com/d/optout.