Re: Two sets of registration with django-registration

2013-09-23 Thread Vibhu Rishi
Thanks for the pointer. Will check out all auth.

V.


On Tue, Sep 24, 2013 at 4:03 AM, Kamil Gałuszka  wrote:

>
> Of course.
>
> First of all I would recommend you using of django-allauth. They are
> having great docs and they support custom user model. django-registration
> is little less maintained and maybe less suitable for your needs.
>
> First you define your custom form in settings.py:
> SIGNUP_FORM_CLASS
>
> Then you are inherit this class
> https://github.com/pennersr/django-allauth/blob/master/allauth/account/adapter.pyand
>  override method save_user to actually do what you want.
>
> And that is it. Is just that simple
>
> Cheers
> Kamil
>
>
>
>
> On Monday, September 23, 2013 7:32:38 PM UTC+2, Vibhu Rishi wrote:
>>
>> Hi,
>>
>> I have 2 types of users with different views of the same page . Using
>> django-registration, I have been able to setup all the signup/password
>> change etc for one level of users - say students.
>>
>> Now I want to have another set of registrations for Teachers. Is there a
>> way to achieve that ?
>>
>> Vibhu
>>
>> --
>> Simplicity is the ultimate sophistication. - Leonardo da Vinci
>> Life is really simple, but we insist on making it complicated. -
>> Confucius
>>
>  --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Need help in my Django program

2013-09-23 Thread ghenessa sabaldan
 

How do I display the updated value from another model, example

>
>  Model A
>
> C = user inputted value
>
>  
>
> Model B
>
> A = initial value of 0 + C 
>
> B = initial value of 50 – A
>
 

So every time a different user input a value in C the A & B will 
automatically be updated, when A = 50 users will not be allowed to enter a 
value in C. This is done in the django administration. Apologies I am 
really new to django and forums :)  

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Two sets of registration with django-registration

2013-09-23 Thread Kamil Gałuszka

Of course.

First of all I would recommend you using of django-allauth. They are having 
great docs and they support custom user model. django-registration is 
little less maintained and maybe less suitable for your needs.

First you define your custom form in settings.py:
SIGNUP_FORM_CLASS

Then you are inherit this class 
https://github.com/pennersr/django-allauth/blob/master/allauth/account/adapter.py
 
and override method save_user to actually do what you want. 

And that is it. Is just that simple

Cheers
Kamil 



On Monday, September 23, 2013 7:32:38 PM UTC+2, Vibhu Rishi wrote:
>
> Hi, 
>
> I have 2 types of users with different views of the same page . Using 
> django-registration, I have been able to setup all the signup/password 
> change etc for one level of users - say students. 
>
> Now I want to have another set of registrations for Teachers. Is there a 
> way to achieve that ? 
>
> Vibhu
>
> -- 
> Simplicity is the ultimate sophistication. - Leonardo da Vinci
> Life is really simple, but we insist on making it complicated. - Confucius 
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: CSV output

2013-09-23 Thread C. Kirby
Whoops, missed the map step.
I think you will need to create a new dict using the try/except above, and 
then map the new dict to str

On Monday, September 23, 2013 5:29:40 PM UTC-5, C. Kirby wrote:
>
> try:
> value = getattr(object, 'get_%s_display' % field)()
> except:
> value getattr(object, field)
>
> On Monday, September 23, 2013 4:47:33 PM UTC-5, Lachlan Musicman wrote:
>>
>> Ok, so here's the challenging part - how would you get the 
>> get_FOO_display value for some but not all of those values? 
>>
>> cheers 
>> L. 
>>
>> On 23 September 2013 23:29, Valder Gallo  wrote: 
>> > :D 
>> > 
>> > 
>> > 
>> > On Mon, Sep 23, 2013 at 10:12 AM, Lachlan Musicman  
>> > wrote: 
>> >> 
>> >> On 23 September 2013 22:47, Valder Gallo  wrote: 
>> >> > Sorry, i really don´t understand why you need this. 
>> >> 
>> >> To mail merge details taken in web app into a report. 
>> >> 
>> >> > If you just wanna convert one object in a list string. 
>> >> > 
>> >> > map(str, object.__dict__.values()) 
>> >> 
>> >> Thanks! Very succinct. 
>> >> 
>> >> L. 
>> >> 
>> >> 
>> >> 
>> >> > 
>> >> > 
>> >> > 
>> >> > 
>> >> > 
>> >> > On Mon, Sep 23, 2013 at 2:56 AM, Lachlan Musicman  
>>
>> >> > wrote: 
>> >> >> 
>> >> >> Hola, 
>> >> >> 
>> >> >> I'm using a standard view function to retrieve all details about an 
>> >> >> object: 
>> >> >> 
>> >> >> header =[] 
>> >> >> headers = object._meta.get_all_field_names() 
>> >> >> row = [] 
>> >> >> for field in headers: 
>> >> >> value = getattr(object, field) 
>> >> >> row.append(value) 
>> >> >> 
>> >> >> to collect info on a particular object passed to a view. 
>> >> >> 
>> >> >> I was wondering how I might exclude the unicode markings on a test 
>> >> >> field (eg: u'text' ) from the output? IE, get rid of all the 
>> leading 
>> >> >> u's. I could just strip/slice but I presume there is a less clunky 
>> >> >> way? 
>> >> >> 
>> >> >> cheers 
>> >> >> L. 
>> >> >> 
>> >> >> -- 
>> >> >> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013: 
>> >> >> When you used to be punk, and now you are still punk but not as 
>> punk, 
>> >> >> are you post-punk or decaying punk or ex-punk or just not punk 
>> anymore 
>> >> >> 
>> >> >> -- 
>> >> >> 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. 
>> >> >> For more options, visit https://groups.google.com/groups/opt_out. 
>> >> > 
>> >> > 
>> >> > 
>> >> > 
>> >> > -- 
>> >> > Valder Gallo 
>> >> > +55 11 9949 2911 
>> >> > +55 11 2532 2911 
>> >> > Skype: valdergallo 
>> >> > @valdergallo 
>> >> > www.valdergallo.com.br 
>> >> > 
>> >> > -- 
>> >> > 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. 
>> >> > For more options, visit https://groups.google.com/groups/opt_out. 
>> >> 
>> >> 
>> >> 
>> >> -- 
>> >> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013: 
>> >> When you used to be punk, and now you are still punk but not as punk, 
>> >> are you post-punk or decaying punk or ex-punk or just not punk anymore 
>> >> 
>> >> -- 
>> >> 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. 
>> >> For more options, visit https://groups.google.com/groups/opt_out. 
>> > 
>> > 
>> > 
>> > 
>> > -- 
>> > Valder Gallo 
>> > +55 11 9949 2911 
>> > +55 11 2532 2911 
>> > Skype: valdergallo 
>> > @valdergallo 
>> > www.valdergallo.com.br 
>> > 
>> > -- 
>> > 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. 
>> > For more options, visit https://groups.google.com/groups/opt_out. 
>>
>>
>>
>> -- 
>> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013: 
>> When you used to be punk, and now you are still 

Re: CSV output

2013-09-23 Thread C. Kirby
try:
value = getattr(object, 'get_%s_display' % field)()
except:
value getattr(object, field)

On Monday, September 23, 2013 4:47:33 PM UTC-5, Lachlan Musicman wrote:
>
> Ok, so here's the challenging part - how would you get the 
> get_FOO_display value for some but not all of those values? 
>
> cheers 
> L. 
>
> On 23 September 2013 23:29, Valder Gallo > 
> wrote: 
> > :D 
> > 
> > 
> > 
> > On Mon, Sep 23, 2013 at 10:12 AM, Lachlan Musicman 
> > > 
>
> > wrote: 
> >> 
> >> On 23 September 2013 22:47, Valder Gallo > 
> wrote: 
> >> > Sorry, i really don´t understand why you need this. 
> >> 
> >> To mail merge details taken in web app into a report. 
> >> 
> >> > If you just wanna convert one object in a list string. 
> >> > 
> >> > map(str, object.__dict__.values()) 
> >> 
> >> Thanks! Very succinct. 
> >> 
> >> L. 
> >> 
> >> 
> >> 
> >> > 
> >> > 
> >> > 
> >> > 
> >> > 
> >> > On Mon, Sep 23, 2013 at 2:56 AM, Lachlan Musicman 
> >> > > 
>
> >> > wrote: 
> >> >> 
> >> >> Hola, 
> >> >> 
> >> >> I'm using a standard view function to retrieve all details about an 
> >> >> object: 
> >> >> 
> >> >> header =[] 
> >> >> headers = object._meta.get_all_field_names() 
> >> >> row = [] 
> >> >> for field in headers: 
> >> >> value = getattr(object, field) 
> >> >> row.append(value) 
> >> >> 
> >> >> to collect info on a particular object passed to a view. 
> >> >> 
> >> >> I was wondering how I might exclude the unicode markings on a test 
> >> >> field (eg: u'text' ) from the output? IE, get rid of all the leading 
> >> >> u's. I could just strip/slice but I presume there is a less clunky 
> >> >> way? 
> >> >> 
> >> >> cheers 
> >> >> L. 
> >> >> 
> >> >> -- 
> >> >> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013: 
> >> >> When you used to be punk, and now you are still punk but not as 
> punk, 
> >> >> are you post-punk or decaying punk or ex-punk or just not punk 
> anymore 
> >> >> 
> >> >> -- 
> >> >> 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. 
> >> >> For more options, visit https://groups.google.com/groups/opt_out. 
> >> > 
> >> > 
> >> > 
> >> > 
> >> > -- 
> >> > Valder Gallo 
> >> > +55 11 9949 2911 
> >> > +55 11 2532 2911 
> >> > Skype: valdergallo 
> >> > @valdergallo 
> >> > www.valdergallo.com.br 
> >> > 
> >> > -- 
> >> > 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. 
> >> > For more options, visit https://groups.google.com/groups/opt_out. 
> >> 
> >> 
> >> 
> >> -- 
> >> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013: 
> >> When you used to be punk, and now you are still punk but not as punk, 
> >> are you post-punk or decaying punk or ex-punk or just not punk anymore 
> >> 
> >> -- 
> >> 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. 
> >> For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
> > 
> > 
> > -- 
> > Valder Gallo 
> > +55 11 9949 2911 
> > +55 11 2532 2911 
> > Skype: valdergallo 
> > @valdergallo 
> > www.valdergallo.com.br 
> > 
> > -- 
> > 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. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
>
>
>
> -- 
> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013: 
> When you used to be punk, and now you are still punk but not as punk, 
> are you post-punk or decaying punk or ex-punk or just not punk anymore 
>

-- 
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+u

Re: CSV output

2013-09-23 Thread Lachlan Musicman
Ok, so here's the challenging part - how would you get the
get_FOO_display value for some but not all of those values?

cheers
L.

On 23 September 2013 23:29, Valder Gallo  wrote:
> :D
>
>
>
> On Mon, Sep 23, 2013 at 10:12 AM, Lachlan Musicman 
> wrote:
>>
>> On 23 September 2013 22:47, Valder Gallo  wrote:
>> > Sorry, i really don´t understand why you need this.
>>
>> To mail merge details taken in web app into a report.
>>
>> > If you just wanna convert one object in a list string.
>> >
>> > map(str, object.__dict__.values())
>>
>> Thanks! Very succinct.
>>
>> L.
>>
>>
>>
>> >
>> >
>> >
>> >
>> >
>> > On Mon, Sep 23, 2013 at 2:56 AM, Lachlan Musicman 
>> > wrote:
>> >>
>> >> Hola,
>> >>
>> >> I'm using a standard view function to retrieve all details about an
>> >> object:
>> >>
>> >> header =[]
>> >> headers = object._meta.get_all_field_names()
>> >> row = []
>> >> for field in headers:
>> >> value = getattr(object, field)
>> >> row.append(value)
>> >>
>> >> to collect info on a particular object passed to a view.
>> >>
>> >> I was wondering how I might exclude the unicode markings on a test
>> >> field (eg: u'text' ) from the output? IE, get rid of all the leading
>> >> u's. I could just strip/slice but I presume there is a less clunky
>> >> way?
>> >>
>> >> cheers
>> >> L.
>> >>
>> >> --
>> >> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013:
>> >> When you used to be punk, and now you are still punk but not as punk,
>> >> are you post-punk or decaying punk or ex-punk or just not punk anymore
>> >>
>> >> --
>> >> 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.
>> >> For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> >
>> >
>> >
>> > --
>> > Valder Gallo
>> > +55 11 9949 2911
>> > +55 11 2532 2911
>> > Skype: valdergallo
>> > @valdergallo
>> > www.valdergallo.com.br
>> >
>> > --
>> > 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.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>> --
>> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013:
>> When you used to be punk, and now you are still punk but not as punk,
>> are you post-punk or decaying punk or ex-punk or just not punk anymore
>>
>> --
>> 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.
>> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
> --
> Valder Gallo
> +55 11 9949 2911
> +55 11 2532 2911
> Skype: valdergallo
> @valdergallo
> www.valdergallo.com.br
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013:
When you used to be punk, and now you are still punk but not as punk,
are you post-punk or decaying punk or ex-punk or just not punk anymore

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


How to track user behavior in django application

2013-09-23 Thread Anu G
I am building a site using django I am new to django. What I am trying to 
do is to track user clicks on pages and store that information. It would be 
great if someone can point to a simple example where adding functionality 
that requires to track data to the front end and capturing it from the 
backend. 

An exmaple Like: 

Creating backend model and middleware to handle this type of scenario and 
then how to add those changes in the templates would be great. 

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.
For more options, visit https://groups.google.com/groups/opt_out.


ManyToMany intermediary models with no required extra fields

2013-09-23 Thread antialiasis
Say you have a model with a ManyToManyField to another model:

class Band(models.Model):
...
members = models.ManyToManyField('Person')

And now, say you decide that you want to use a custom intermediary model 
for the relationship, *without any required extra fields*. This could 
happen if, for instance, you would like to register a signal on the 
intermediary model, or if the only extra information you would like to add 
to the intermediary model is a DateTimeField with auto_now_add=True, or if 
the only extra fields you add have a sensible default that you're usually 
not going to want to mess with when you add a member to a band. This seems 
like a fairly simple, commonplace use case.

That simple use case, however, creates extremely tiresome complications 
stemming from Django's *thinking* there are some fields on the intermediary 
model that you're going to want to set, and therefore removing your ability 
to use the ManyRelatedManager's add or remove methods, a ModelForm's 
save_m2m method, etc. etc. etc. If only Django would stop thinking it knows 
better than you whether you need to set extra fields on the relationship 
and do exactly the same thing it does when the intermediary model is 
auto-created, everything would work swimmingly; however, because it 
doesn't, a bunch of code needs to be changed.

I've browsed around the Internet enough every time I've run into this 
problem that I believe I know there is no actual solution other than 
sucking it up, so that's not my question. My question is whether there are 
any plans to make Django a bit smarter and less overzealous about deciding 
you need to set extra information on the relationship, or whether I should 
make a ticket requesting this.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Ulr internationalization

2013-09-23 Thread Duke
Hi guys,

How I can to use "Url internationalization" on my project that running with the 
Django version 1.3 ?,
I want to use only this feature without update the version, thought inherit the 
locale midleware and edit this but any suggestion?

Thanks.

Sean N.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Template Syntax Error

2013-09-23 Thread Alagappan
Looks like the is an issue in Django being able to resolve URLs in your
application. Can you paste your urls.py for more info.


Regards,
Alagappan R

Twitter: @_alagappan 

Thanks & Regards,
Alagappan Ramu
+1 (716) 598 2730

Graduate Student in Computer Science
University at Buffalo, The State University of New
York.



On Mon, Sep 23, 2013 at 7:12 AM, SHANTANU SRIVASTAVA <
shan_m...@rediffmail.com> wrote:

>
> Hi People ! Just started development with Django and am stuck with this
> error. When I run my admin panel from the server (default server of django)
> the browser shows this error "TemplateSyntaxError
> " - Caught RuntimeError while rendering: maximum recursion depth exceeded
> while calling a Python object. Help me in resolving this ! Any help
> appreciated .
>
> I am developing on a 64bit x86 machine. OS-Windows - 7.
>
> The tracebacks and detailed report is here :
> http://dpaste.com/1392716/plain/
>
> It is also attached as an attachment with this mail.
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: custom if tag

2013-09-23 Thread Alagappan
You can implement has_applied as a filter instead of a template tag.
https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-filters

Haven't check it, but something like {% if user|has_applied_filter: opening
%} should essentially work out for your case.


Another alternative could be use of assignment
tags.
>From documentation "This function works the same way as
simple_tag,
except that it stores the tag’s result in a specified context variable
instead of directly outputting it.".

Regards,
Alagappan R

Twitter: @_alagappan 

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


RE: How do I create a standalone python application that uses the django environment (e.g. the ORM etc...)?

2013-09-23 Thread Sells, Fred
Creating django management commands is easy and then all works nicely.  
Assuming you're at 1.5, not sure about older ones.  Just google it.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of DJ-Tom
Sent: Monday, September 16, 2013 10:26 AM
To: django-users@googlegroups.com
Subject: How do I create a standalone python application that uses the django 
environment (e.g. the ORM etc...)?

For reporting purposes I want to use List & Label from Combit. The web/online 
part is no big deal since the reporting module can be run without user 
interface (creating Excel or PDF files)

But the actual form designer part that is used to define the report layout is a 
windows GUI application, so I would like to have a python file inside my Django 
app that I can call to start the designer part on my local machine.

I have now read a bunch of descriptions on how to use Django in a standalone 
application but did not succeed so far in actually running my form designer.

This is what I currently have, i tried to start this via "python 
formdesigner.py", after activating the correct virtualenv:

from Tkinter import *
from ctypes import *
import django
from models import *

LL = windll.cmll18

### Declaration of application class omitted, this is plain python  

app = Application()
app.master.title("List & Label sample application")
app.mainloop()


Regardless what I try, I can't get the model class import to work.

I also tried SET DJANGO_SETTINGS_MODULE=settings and project.settings and 
project.app.settings... nothing worked.

thomas
--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com.
To post to this group, send email to 
django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


custom if tag

2013-09-23 Thread Vibhu Rishi
Hi,

My scenario is that users would have applied for some job opening. I need
to do something like the following in my templates :

{% if has_applied opening user %}
You have applied
{% else %}
Click to apply
{% endif %}

However, so far i have been using templatetags and got the following only:
{% has_applied opening user %}

This returns a True or False from the implementation in
templatetags/project_extras.py as:

@register.simple_tag
def has_applied(opening,user):
applied = False
try:
connect = Connect.objects.get(user=user, connecting_to=opening)
applied = True
except:
applied= False
return applied

I get the correct True or False return from this function , but i am not
able to figure out how to use it with an if statement in the html
templates. Any pointers ?

Regards,
Vibhu


-- 
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Two sets of registration with django-registration

2013-09-23 Thread Vibhu Rishi
Hi,

I have 2 types of users with different views of the same page . Using
django-registration, I have been able to setup all the signup/password
change etc for one level of users - say students.

Now I want to have another set of registrations for Teachers. Is there a
way to achieve that ?

Vibhu

-- 
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Mysterious error messages

2013-09-23 Thread Joseph Mutumi
Don't use Satchmo but looks like `shop_config` is not defined when you
context_processors are called?

This is because from it looks like it gets the shop_config based on the
current site based on the host. If the domain name saved in the admin for
the site corresponding to the SITE_ID in your settings.py is incorrect or
different from the host header in the HTTP request, it could possible cause
this error.


On Sun, Sep 22, 2013 at 6:02 PM, kooliah <
kool...@djeve.sites.djangohosting.ch> wrote:

>  I'm sorry but i started to send this message at 12.09 ...and at 14.00
> google groups still does not show me neither on mail or web-interface. so i
> resend...
>
> Sorry again, next time i'll wait 24 hours, to see if a post is sent...
>
>
>
>
>
> On 09/22/2013 04:27 PM, Avraham Serour wrote:
>
> really? how many times do you need to send and resend and cross post?
>
>
> On Sun, Sep 22, 2013 at 1:23 PM,  wrote:
>
>>  Everyday i receive 5-10 mysterious error messages of this kind
>>
>> ... ERRORS.
>>
>>   File
>> "../satchmo/satchmo/apps/satchmo_store/shop/context_processors.py",
>> line 31, in settings
>> 'shop_name': shop_config.store_name,
>>
>> AttributeError: 'NoneType' object has no attribute 'store_name'
>>
>>
>> > path:/plugins/tinymce_plugin/tiny_mce/plugins/more/editor_plugin.js,
>> GET:,
>> POST:,
>>
>> 
>>
>>   File
>> ".../satchmo/satchmo/apps/satchmo_store/shop/context_processors.py", line
>> 31, in settings
>> 'shop_name': shop_config.store_name,
>>
>> AttributeError: 'NoneType' object has no attribute 'store_name'
>>
>>
>> > path:/admin/login.aspx,
>> GET:,
>>
>> 
>>
>>   File "/django/db/backends/postgresql_psycopg2/base.py", line 52, in
>> execute
>> return self.cursor.execute(query, args)
>>
>> DatabaseError: server closed the connection unexpectedly
>> This probably means the server terminated abnormally
>> before or while processing the request.
>>
>>
>>
>> > path:/art_folder/text-image_Series-1.jpg,
>> GET:,
>> POST:,
>>
>> 
>>
>> 
>>
>> 
>>
>> ...END ERRORS..
>>
>> All of them do not depend by my code but by django/satchmo source code,
>> and never rise on developing serverbut the thing I don't understand is
>> paths I have no paths like them...Why it does not give "page not found"
>> but Errors ??
>> If i give that url in browser it correctly gives me "page not
>> found"
>>
>> Thank you
>>
>> Alkatron
>> --
>> 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.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>  --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Empty context within template tag render() method after using django.test.client.Client.login() method

2013-09-23 Thread Jonathan Baker
Below are some snippets involved in generating the error. The
'test_get_unauthenticated' works as expected, but 'test_get_ok' fails while
rendering the template response and calling the menu tag of django-menu
(full module:
https://github.com/rossp/django-menu/blob/master/menu/templatetags/menubuilder.py
).

*integration_tests.py*
class IntegrationTestCase(TestCase):
def setUp(self):
self.client = Client()
self.test_domain = "http://testserver";

class AccountDetail(IntegrationTestCase):
def test_get_unauthenticated(self):
"""302"""
destination = reverse("account_detail")
response = self.client.get(destination)
self.assertRedirects(response, reverse("login") + "?next=" +
destination)

def test_get_ok(self):
"""200"""
user = UserFactory.create()
self.client.login(username=user.username, password="testPass")
response = self.client.get(reverse("account_detail"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "accounts/account_detail.html")

*menubuilder.py*
class MenuObject(template.Node):
def __init__(self, menu_name):
self.menu_name = menu_name

def render(self, context):
current_path = context['request'].path
user = context['request'].user
context['menuitems'] = get_items(self.menu_name, current_path, user)
return ''


On Sun, Sep 22, 2013 at 5:36 PM, jondbaker wrote:

> Within my integration tests, it appears that after using the login()
> method of django.test.client.Client the context dict consists only of:
>
> [{'False': False, 'None': None, 'True': True}, {}, {}].
>
> If I remove the use of login(), then the request dict consists of:
>
> [{'False': False, 'None': None, 'True': True}, {'object':  te...@test.com>, 'user': , u'view':
> }, {u'csrf_token':
> }, {'perms':
> ,
> 'user': },
> {}, {u'MEDIA_URL': '/media/'}, {'messages':
>  0x1393c10>}, {u'request':  path:/accounts/,
> GET:,
> POST:,
> COOKIES:{'sessionid': 'q27przqeidsnfykuufu7m6lo7nw606qw'},
> META:{u'CONTENT_TYPE': 'text/html; charset=utf-8',
>  u'CSRF_COOKIE': u'9mWW7nGMJQAgbs3KBB3oEPofbLBCkLW2',
>  u'HTTP_COOKIE': u' sessionid=q27przqeidsnfykuufu7m6lo7nw606qw;
> Domain=None; expires=None; Max-Age=None; Path=/; secure',
>  u'PATH_INFO': u'/accounts/',
>  u'QUERY_STRING': '',
>  u'REMOTE_ADDR': '127.0.0.1',
>  u'REQUEST_METHOD': 'GET',
>  u'SCRIPT_NAME': u'',
>  u'SERVER_NAME': 'testserver',
>  u'SERVER_PORT': '80',
>  u'SERVER_PROTOCOL': 'HTTP/1.1',
>  u'wsgi.errors': <_io.BytesIO object at 0x2358050>,
>  u'wsgi.input': ,
>  u'wsgi.multiprocess': True,
>  u'wsgi.multithread': False,
>  u'wsgi.run_once': False,
>  u'wsgi.url_scheme': 'http',
>  u'wsgi.version': (1, 0)}>}, {u'STATIC_URL': '/static/'}, {}]
>
> I noticed the problem when a template tag was trying to access
> context["request"].path and a KeyError was raised after using login. Both
> outputs above are the result of printing the context var from within the
> render() method of a template tag. Any help would be greatly appreciated,
> as I'm a bit stumped.
>
> Thanks,
> Jonathan
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Jonathan D. Baker
Developer
http://jonathandbaker.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.
For more options, visit https://groups.google.com/groups/opt_out.


CalDAV / CardDAV

2013-09-23 Thread Miloš Kozák
Hi, I have been looking around for a something like tastypie but for 
CalDAV/CardDAV.. I am running something like CRM in our small company based 
on Django.. So I had an idea to export contacts to cell phones using 
CardDAV but I could find anything. So I ma wondering what is the problem? 
Is it related to WSGI or just nobody need it?
¨Thanks for answers, Milos

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: "no such column" database error in admin

2013-09-23 Thread Avraham Serour
it looks like you changed the model after running syncdb, syncdb is able to
create tables but not to add or remove columns.

for that you should take a look at south, it is called database migrations.

you may also delete the database and recreate


On Mon, Sep 23, 2013 at 10:53 AM, Beverly Block
wrote:

> I'm trying to use the admin interface, and while it's working for my User
> object, when I try to access the Event object I get this:
>
> Request Method: GET  Request URL: http://localhost:8000/admin/test1/event/  
> Django
> Version: 1.5.4  Exception Type: DatabaseError  Exception Value:
>
> no such column: test1_event.track
>
>  Exception Location: 
> C:\Python33\lib\site-packages\django\db\backends\sqlite3\base.py
> in execute, line 362  Python Executable: C:\Python33\python.exe  Python
> Version: 3.3.2
> Event does have a foreign key referencing User; I've seen other posts
> about that causing complications, but not this specific one.
>
> I've tried resyncing the db, but it doesn't help.
>
> Thoughts?
>
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: CSV output

2013-09-23 Thread Valder Gallo
:D



On Mon, Sep 23, 2013 at 10:12 AM, Lachlan Musicman wrote:

> On 23 September 2013 22:47, Valder Gallo  wrote:
> > Sorry, i really don´t understand why you need this.
>
> To mail merge details taken in web app into a report.
>
> > If you just wanna convert one object in a list string.
> >
> > map(str, object.__dict__.values())
>
> Thanks! Very succinct.
>
> L.
>
>
>
> >
> >
> >
> >
> >
> > On Mon, Sep 23, 2013 at 2:56 AM, Lachlan Musicman 
> wrote:
> >>
> >> Hola,
> >>
> >> I'm using a standard view function to retrieve all details about an
> >> object:
> >>
> >> header =[]
> >> headers = object._meta.get_all_field_names()
> >> row = []
> >> for field in headers:
> >> value = getattr(object, field)
> >> row.append(value)
> >>
> >> to collect info on a particular object passed to a view.
> >>
> >> I was wondering how I might exclude the unicode markings on a test
> >> field (eg: u'text' ) from the output? IE, get rid of all the leading
> >> u's. I could just strip/slice but I presume there is a less clunky
> >> way?
> >>
> >> cheers
> >> L.
> >>
> >> --
> >> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013:
> >> When you used to be punk, and now you are still punk but not as punk,
> >> are you post-punk or decaying punk or ex-punk or just not punk anymore
> >>
> >> --
> >> 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.
> >> For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
> >
> >
> > --
> > Valder Gallo
> > +55 11 9949 2911
> > +55 11 2532 2911
> > Skype: valdergallo
> > @valdergallo
> > www.valdergallo.com.br
> >
> > --
> > 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.
> > For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> --
> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013:
> When you used to be punk, and now you are still punk but not as punk,
> are you post-punk or decaying punk or ex-punk or just not punk anymore
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Valder Gallo
+55 11 9949 2911
+55 11 2532 2911
Skype: valdergallo
@valdergallo
www.valdergallo.com.br

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: "Writing First App" Tutorial - no settings

2013-09-23 Thread pa xapy
which version of tutorial you working through?
which version of django did you use?
usually, with latest versions. your settings.py file should be in 
.../myproject/myproject/ folder.

On Monday, September 23, 2013 2:04:07 PM UTC+4, Avril Lang wrote:
>
> So I'm obviously a newbie and working my way through the tutorial. I 
> created a project using startproject but whereas the tutorial is showing 
> that I should see various files in this directory (__init__.py, 
> settings.py  etc) I can only see manage.py. 
>
> I can connect to the server using runserver and it claims to be using 
> mysite.settings but... well I have no access to these. 
>
> Why am I only getting manage.py and how can I fix this?
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: CSV output

2013-09-23 Thread Lachlan Musicman
On 23 September 2013 22:47, Valder Gallo  wrote:
> Sorry, i really don´t understand why you need this.

To mail merge details taken in web app into a report.

> If you just wanna convert one object in a list string.
>
> map(str, object.__dict__.values())

Thanks! Very succinct.

L.



>
>
>
>
>
> On Mon, Sep 23, 2013 at 2:56 AM, Lachlan Musicman  wrote:
>>
>> Hola,
>>
>> I'm using a standard view function to retrieve all details about an
>> object:
>>
>> header =[]
>> headers = object._meta.get_all_field_names()
>> row = []
>> for field in headers:
>> value = getattr(object, field)
>> row.append(value)
>>
>> to collect info on a particular object passed to a view.
>>
>> I was wondering how I might exclude the unicode markings on a test
>> field (eg: u'text' ) from the output? IE, get rid of all the leading
>> u's. I could just strip/slice but I presume there is a less clunky
>> way?
>>
>> cheers
>> L.
>>
>> --
>> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013:
>> When you used to be punk, and now you are still punk but not as punk,
>> are you post-punk or decaying punk or ex-punk or just not punk anymore
>>
>> --
>> 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.
>> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
> --
> Valder Gallo
> +55 11 9949 2911
> +55 11 2532 2911
> Skype: valdergallo
> @valdergallo
> www.valdergallo.com.br
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013:
When you used to be punk, and now you are still punk but not as punk,
are you post-punk or decaying punk or ex-punk or just not punk anymore

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: No settings file in Django tutorial.

2013-09-23 Thread Avril Lang
Thank you!

On Monday, September 23, 2013 12:09:50 PM UTC+2, Avril Lang wrote:
>
> Newb needs some help making the tutorial go
>
> As you can see here I can create a new project and run the server but the 
> only file in my project is manage.py. Where is "settings.py" and how can I 
> get it in the proper location?
>
> Last login: Mon Sep 23 09:19:47 on ttys000
> new-host:~ avrillang$ django-admin.py startproject winker
> new-host:~ avrillang$ winker/
> -bash: winker/: is a directory
> new-host:~ avrillang$ cd winker
> new-host:winker avrillang$ ls
> manage.pywinker
> new-host:winker avrillang$ python manage.py runserver
> Validating models...
>
> 0 errors found
> September 23, 2013 - 04:28:51
> Django version 1.5.4, using settings 'winker.settings'
> Development server is running at http://127.0.0.1:8000/
> Quit the server with CONTROL-C.
> [23/Sep/2013 04:28:59] "GET / HTTP/1.1" 200 1957
> ls winker
> ^Cnew-host:winker avrillang$ 
> new-host:winker avrillang$ ls
> manage.pywinker
> new-host:winker avrillang$ cd settings.py
> -bash: cd: settings.py: No such file or directory
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: CSV output

2013-09-23 Thread Valder Gallo
Sorry, i really don´t understand why you need this.

If you just wanna convert one object in a list string.

map(str, object.__dict__.values())


Other projects to export CSV.

https://github.com/valdergallo/data-importer
https://pypi.python.org/pypi/django-export
https://docs.djangoproject.com/en/dev/howto/outputting-csv/





On Mon, Sep 23, 2013 at 2:56 AM, Lachlan Musicman  wrote:

> Hola,
>
> I'm using a standard view function to retrieve all details about an object:
>
> header =[]
> headers = object._meta.get_all_field_names()
> row = []
> for field in headers:
> value = getattr(object, field)
> row.append(value)
>
> to collect info on a particular object passed to a view.
>
> I was wondering how I might exclude the unicode markings on a test
> field (eg: u'text' ) from the output? IE, get rid of all the leading
> u's. I could just strip/slice but I presume there is a less clunky
> way?
>
> cheers
> L.
>
> --
> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013:
> When you used to be punk, and now you are still punk but not as punk,
> are you post-punk or decaying punk or ex-punk or just not punk anymore
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Valder Gallo
+55 11 9949 2911
+55 11 2532 2911
Skype: valdergallo
@valdergallo
www.valdergallo.com.br

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: No settings file in Django tutorial.

2013-09-23 Thread Frankline
You are trying to change directory through a file i.e. settings.py. This is
obviously not a directory but a file. In any case, it does not exist within
that directory level.

What you need to do is:
$ cd winker
$ ls

And you will see your setting file

I am assuming your directory structure is as follows:

winker
|
|- manage.py
|- winker
|
|- settings.py
|- urls.py
|- wsgi.py

Note that there are two winker directories. Pay attention to the current
directory that you are located in.


On Mon, Sep 23, 2013 at 1:09 PM, Avril Lang  wrote:

> Newb needs some help making the tutorial go
>
> As you can see here I can create a new project and run the server but the
> only file in my project is manage.py. Where is "settings.py" and how can I
> get it in the proper location?
>
> Last login: Mon Sep 23 09:19:47 on ttys000
> new-host:~ avrillang$ django-admin.py startproject winker
> new-host:~ avrillang$ winker/
> -bash: winker/: is a directory
> new-host:~ avrillang$ cd winker
> new-host:winker avrillang$ ls
> manage.pywinker
> new-host:winker avrillang$ python manage.py runserver
> Validating models...
>
> 0 errors found
> September 23, 2013 - 04:28:51
> Django version 1.5.4, using settings 'winker.settings'
> Development server is running at http://127.0.0.1:8000/
> Quit the server with CONTROL-C.
> [23/Sep/2013 04:28:59] "GET / HTTP/1.1" 200 1957
> ls winker
> ^Cnew-host:winker avrillang$
> new-host:winker avrillang$ ls
> manage.pywinker
> new-host:winker avrillang$ cd settings.py
> -bash: cd: settings.py: No such file or directory
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


No settings file in Django tutorial.

2013-09-23 Thread Avril Lang
Newb needs some help making the tutorial go

As you can see here I can create a new project and run the server but the 
only file in my project is manage.py. Where is "settings.py" and how can I 
get it in the proper location?

Last login: Mon Sep 23 09:19:47 on ttys000
new-host:~ avrillang$ django-admin.py startproject winker
new-host:~ avrillang$ winker/
-bash: winker/: is a directory
new-host:~ avrillang$ cd winker
new-host:winker avrillang$ ls
manage.pywinker
new-host:winker avrillang$ python manage.py runserver
Validating models...

0 errors found
September 23, 2013 - 04:28:51
Django version 1.5.4, using settings 'winker.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[23/Sep/2013 04:28:59] "GET / HTTP/1.1" 200 1957
ls winker
^Cnew-host:winker avrillang$ 
new-host:winker avrillang$ ls
manage.pywinker
new-host:winker avrillang$ cd settings.py
-bash: cd: settings.py: No such file or directory

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


"no such column" database error in admin

2013-09-23 Thread Beverly Block
I'm trying to use the admin interface, and while it's working for my User 
object, when I try to access the Event object I get this:

Request Method: GET  Request URL: http://localhost:8000/admin/test1/event/  
Django 
Version: 1.5.4  Exception Type: DatabaseError  Exception Value: 

no such column: test1_event.track

 Exception Location: 
C:\Python33\lib\site-packages\django\db\backends\sqlite3\base.py 
in execute, line 362  Python Executable: C:\Python33\python.exe  Python 
Version: 3.3.2
Event does have a foreign key referencing User; I've seen other posts about 
that causing complications, but not this specific one.

I've tried resyncing the db, but it doesn't help.

Thoughts?

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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Is there a tutorial for django-allauth?

2013-09-23 Thread Floyd Gregori
http://web.archive.org/web/20130202050244/http://techstricks.com/django-allauth-tutorial-step-by-step/

You're 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.
For more options, visit https://groups.google.com/groups/opt_out.


"Writing First App" Tutorial - no settings

2013-09-23 Thread Avril Lang
So I'm obviously a newbie and working my way through the tutorial. I 
created a project using startproject but whereas the tutorial is showing 
that I should see various files in this directory (__init__.py, 
settings.py  etc) I can only see manage.py. 

I can connect to the server using runserver and it claims to be using 
mysite.settings but... well I have no access to these. 

Why am I only getting manage.py and how can I fix this?

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Testing in Django - newbie questions on first test failure and coverage

2013-09-23 Thread Derek
Hi  

Yes, you are right: deleting the _fixture_setup method allows the tests to 
run successfully!  

I also do have all my fixture data stored in 
'appname/fixtures/initial_data.json' so I assume from what you say that 
this data will only be loaded once for all the tests.

Once I have more confidence with further tests, I will also try with 
factoryboy for other, non-fixture, data I need to test.

Thanks again for all the help here.

Derek

On Sunday, 15 September 2013 15:37:35 UTC+2, Derek wrote:
>
> I have an existing Django (1.4) project, with multiple apps and extensive 
> business logic, that I need to write tests for.  Based on a day or two of 
> reading of the core Django docs and numerous blogs (each of which go about 
> things subtly differently!?), I have made a start.  As part of the seeming 
> "best practice" setup, I have also installed django-nose and coverage.
>
> Currently, I have problems with my first test not working and also with 
> coverage seemingly not finding my test. 
>  
> I have a separate `tests` directory in my project, with sub-directories; 
> each corresponding to an app.  Each sub-directory then has a models, views, 
> and functions Python files; acting as placeholders for the test code I 
> think need to write.  In the root of the `tests` directory, I have an 
> __init__.py file that has a number of lines that look like `from 
> myproj.app1.functions import *`.
>
> I have changed the settings.py file to look like this (so that the tests 
> use a "fast" sqlite database):
>
> if 'test' in sys.argv:
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.sqlite3',
> 'NAME': 'test_db'
> }
> }
> else:
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.mysql',
> # etc ... normal setup
>
>
> The first test, in the first functions.py file, looks like this:
>
>
> from django.test import TestCase
> from django.core import management
> from app1.models import default_Property  # function to be tested
>
> def setup():
> management.call_command('loaddata', 'app1/fixtures/initial_data.json', 
> verbosity=1)
>
> def teardown():
> management.call_command('flush', verbosity=1, interactive=False)
>
> class FunctionsTestCase(TestCase):
>
> def _fixture_setup(self):
> pass
>
> def test_default_Property(self):
> self.assertEqual(default_Property(), None)
>
>
> The default_Property() function in app1 is just set to `return None` for 
> now, so that the above test should work.
>
> However, the test fails.  I get this strange error:
>
> ==
> ERROR: test_default_Property (myproj.app1.tests.FunctionsTestCase)
> --
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.7/dist-packages/django/test/testcases.py", 
> line 508, in __call__
> self._post_teardown()
>   File "/usr/local/lib/python2.7/dist-packages/django/test/testcases.py", 
> line 522, in _post_teardown
> self._fixture_teardown()
>   File "/usr/local/lib/python2.7/dist-packages/django/test/testcases.py", 
> line 847, in _fixture_teardown
> transaction.leave_transaction_management(using=db)
>   File "/usr/local/lib/python2.7/dist-packages/django/db/transaction.py", 
> line 52, in leave_transaction_management
> connection.leave_transaction_management()
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", 
> line 115, in leave_transaction_management
> raise TransactionManagementError("This code isn't under transaction "
> TransactionManagementError: This code isn't under transaction management
> --
>
> I could not find an obvious solution to this, as I do not even have 
> TransactionMiddleware enabled in my settings.
>
> The other issue relates to coverage - it does not seem to recognise I have 
> written this test and still flags it as `red` ... Currently I am using 
> `coverage html' - but how I get it work properly?
>
> Any help getting started overcoming these issues will be helpful, so I can 
> get on with the actual business of writing tests.  (As a side-note, if 
> there is a good existing code base, for a Django-based project, that has 
> test code I could look at, I'd appreciate a link to it.)
>
> Thanks
> Derek
>
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Testing in Django - newbie questions on first test failure and coverage

2013-09-23 Thread Derek
Hi Rafael

Yes, you are right: deleting the _fixture_setup method allows the tests to 
run successfully! 

I also do have all my fixture data stored in 
'appname/fixtures/initial_data.json' so I assume from what you say that 
this data will only be loaded once for all the tests.

Once I have more confidence with further tests, I will also try out 
factory_boy for other, non-fixture, data I need to test.

Thanks again for all the help here.

Derek

On Sunday, 22 September 2013 12:40:16 UTC+2, Rafael Durán Castañeda wrote:
>
> Hi,
>
>
> El 21/09/2013, a las 13:36, Derek > 
> escribió:
>
> Rafael
>
> I appreciate your reply; below I try and explain further the reasoning 
> behind the approach I took.  If you can respond to that, it would help.
>
>
> Firstly, the issue of test file locations - there are least two places I 
> have found that recommend these be placed in a different directory:
>
> From http://toastdriven.com/blog/2011/apr/17/guide-to-testing-in-django-2/
>
> "I prefer to split up the tests into a file structure that mirrors the 
> app's setup. To do this, we create a new tests directory then move the 
> existing tests.py into tests/views.py."
>
>
> It doesn´t matter if app.tests is a module or a package (some test runners 
> will need tests being importable from app.tests in order to work), so that 
> approach still uses default location as I suggested.
>
> From 
> https://pycon-2012-notes.readthedocs.org/en/latest/testing_and_django.html
>
> "Don’t make the mistake of putting the tests for your app in a tests.py, 
> because then other people who use your app will be forced to run your tests 
> when they don’t really need to. Better to put your tests in another 
> directory."
>
>
> I don´t agree this, since people who don´t want run app.tests can just use 
> a test runner that runs only your tests (as django-nose and pytest-django 
> do); even if you don´t want your tests to be run, you can just exclude them 
> in the setup.py.
>
> So this approach should be OK; and the tests seem work - but with that 
> strange error message.  Still not sure what the exact cause is…
>
>
> Looking further to stackoverflow example, I´ve got the same error as you, 
> but I managed  to solve it just deleting the _fixture_setup method, so my 
> guess was wrong (since there is no conflict with loading/flushing data this 
> way) but  disabling _fixture_setup seems to break Django tests transaction 
> management (tested with Django 1.5).
>
>
> Thanks for the factory_boy suggestion.  I had looked at it, but was trying 
> to avoid having to learn too may things all at once!  The code I have used 
> for loading my fixtures comes from 
> http://stackoverflow.com/questions/979434/how-to-load-fixtures-only-once-in-django-unit-tests
>   
> - and I added that because of the exact problem raised in that question; 
> that Django reloads the fixtures for every single test; and that just seems 
> to slow things right down (we have a lot of fixtures we need for our 
> database).  if you can suggest another or better way to load our fixtures 
> just once for a whole class of tests, I'd appreciate hearing about that.
>
>
> If you need load fixtures just once, you can use initial_data fixture (you 
> can change fixture directories setting in your test settings if you don´t 
> want mess with your production data). However if you need different 
> fixtures to be loaded depending on your test module, your approach may be 
> the right choice; thought you probably want to check django-nose fast 
> fixtures https://github.com/jbalogh/django-nose#enabling-fast-fixtures or 
> just create DB objects programmatically (using factory_boy or whatever).
>
> HTH,
> Rafael
>
>
> Thanks
> Derek
>
>
> On Monday, 16 September 2013 23:20:41 UTC+2, Rafael Durán Castañeda wrote:
>>
>> Hi,
>>
>> Some answers inline and links at the end:
>>
>> 2013/9/15 Derek 
>>
>>> I have an existing Django (1.4) project, with multiple apps and 
>>> extensive business logic, that I need to write tests for.  Based on a day 
>>> or two of reading of the core Django docs and numerous blogs (each of which 
>>> go about things subtly differently!?), I have made a start.  As part of the 
>>> seeming "best practice" setup, I have also installed django-nose and 
>>> coverage.
>>>
>>> Currently, I have problems with my first test not working and also with 
>>> coverage seemingly not finding my test. 
>>>  
>>> I have a separate `tests` directory in my project, with sub-directories; 
>>> each corresponding to an app.  Each sub-directory then has a models, views, 
>>> and functions Python files; acting as placeholders for the test code I 
>>> think need to write.  In the root of the `tests` directory, I have an 
>>> __init__.py file that has a number of lines that look like `from 
>>> myproj.app1.functions import *`.
>>>
>>  
>> Most Django apps. place tests into the app. directory tests 
>> module/package, so I think your layout may cause some Django test runner 
>> may not able to