Re: Custom password validation
hey man, how are you ? I don't know if I understand very well, but you can try make a custom user and in forms file you can do the validation that you need. :D if that's right, you can follow this example: http://www.lasolution.be/blog/creating-custom-user-model-django-16-part-1.html I hope to have helped you! Em sex, 10 de abr de 2015 às 19:39, Larry Martell escreveu: > On Fri, Apr 10, 2015 at 3:14 PM, Larry Martell > wrote: > > I am trying to add custom password validation to the create user and > > change password admin forms. I did not see anything in the django docs > > about how to do this. From what I read on stackoverflow and other > > sites it seems I have to write a validator and then someone hook it > > into the add and change forms. > > > > Here's what I have now in my apps admin.py: > > > > def validate_password_strength(value): > > """Validates that a password is as least 10 characters long and has > at least > > 2 digits and 1 Upper case letter. > > """ > > min_length = 10 > > > > if len(value) < min_length: > > raise ValidationError(_('Password must be at least {0} > characters ' > > 'long.').format(min_length)) > > > > # check for 2 digits > > if sum(c.isdigit() for c in value) < 2: > > raise ValidationError(_('Password must container at least 2 > digits.')) > > > > # check for uppercase letter > > if not any(c.isupper() for c in value): > > raise ValidationError(_('Password must container at least 1 > > uppercase letter.')) > > > > class MySetPasswordForm(SetPasswordForm): > > def __init__(self, *args, **kwargs): > > super(MySetPasswordForm, self).__init__(*args, **kwargs) > > > self.fields['password1'].validators.append(validate_password_strength) > > > > But what I can't figure out is how do I get MySetPasswordForm to be > > used. Can anyone help me with this. If i am way off base, can someone > > point me in the right direction. Thanks! > > I've tried a few different things. First I did this: > > class UserAdmin(UserAdmin): > form = MySetPasswordForm > > # Re-register UserAdmin > admin.site.unregister(User) > admin.site.register(User, UserAdmin) > > And I got this error: > > : (admin.E016) > The value of 'form' must inherit from 'BaseModelForm'. > > So then I changed MySetPasswordForm to inherit from BaseModelForm and > then I got this error: > > __init__() missing 1 required positional argument: 'user' > > So then I added the user param so now MySetPasswordForm looked like this: > > class MySetPasswordForm(BaseModelForm): > def __init__(self, user, *args, **kwargs): > super(MySetPasswordForm, self).__init__(user, *args, **kwargs) > > self.fields['password1'].validators.append(validate_password_strength) > > But I still got the same error as before. > > I can't believe it's this hard to add a password validator. It must be > a very common need, so clearly I must be missing something simple. Can > anyone please provide some assistance here. > > -- > 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/CACwCsY7e%3DkTtvs71PdDG66h1X%3DisWGCgjs7LdpXFtG-n3hRjDQ%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/CABcoSmCTX8oOKJ5wsJXaS3b%3DfgfTPwKo6n1e68cVFfdiL-Zi6A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Python Brasil [10] - Call for papers
This year the PYBR will be "FODA". \o 2014-08-09 15:30 GMT+01:00 Renato Oliveira : > Hi all, > > You have until tomorrow to submit your talk to Python Brasil [10]. > > http://2014.pythonbrasil.org.br/dashboard/proposals/ > > The conference will be amazing! See why: > > Our Keynotes -> http://2014.pythonbrasil.org.br/speakers/ > > Our Venue -> http://2014.pythonbrasil.org.br/news/the-conference-venue/ > > And on November 9th were going to have some activities (TBA) like scuba > diving, standup paddle > <https://www.google.com.br/search?q=standup+paddle&safe=off&es_sm=93&source=lnms&tbm=isch&sa=X&ei=qC7mU-PGKKq-sQTC3oKgDQ&ved=0CAgQ_AUoAQ&biw=1325&bih=659> > and > others! > > Thanks and see you in Porto de Galinhas! > > Renato Oliveira > @_renatooliveira <http://twitter.com/_renatooliveira> > Labcodes - www.labcodes.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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAGPLouU_jBpejAhbwSZ3d_6FYWSJ5jFj5u8xW%3DgRjZXSEfz9jw%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAGPLouU_jBpejAhbwSZ3d_6FYWSJ5jFj5u8xW%3DgRjZXSEfz9jw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Helton Alves Desenvolvedor web Graduado em Sistemas de Informação - FACIMP Cursando Metodologia do Ensino Superior - INESPO -- 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/CABcoSmA1oVqcyYrdr5vj-vNfOyXv1ZnWBvGnTvWPW2YNE4dr5w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Migrating to a custom User model with South
do you put your "myappname" in INSTALLED_APPS on settings ? 2014-09-01 8:17 GMT+01:00 Guy Tamir : > Hey all, > > I'm trying to create a custom User model on an existing project (Django > 1.5.5). > I followed this tutorial > <http://www.caktusgroup.com/blog/2013/08/07/migrating-custom-user-model-django/>, > I created the new model, ran a "schemamigration" once, which created the > tables in the DB, > also ran the "Migrate" command once with the copying code in the "forward" > method (like instructed in the tutorial in bullet no. 10. > > The new custom model table was created and all the previous users were > copied correctly. > Now, I'm trying to change the "AUTH_USER_MODEL" to newly created custom > User model, but when I run the migrate command I'm getting > this error: > ImproperlyConfigured: AUTH_USER_MODEL refers to model > 'myappname.CustomUser' that has not been installed > > I'm new to South, and this is my first time trying to work with the custom > User option.. > Not really sure how to fix this.. > > Some more details: > Django=1.5.5 > South=1.0 > Using Postgresql > > 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/1c65a221-124a-4c24-ad96-1b7e7e44e3e8%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/1c65a221-124a-4c24-ad96-1b7e7e44e3e8%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Helton Alves Desenvolvedor web Graduado em Sistemas de Informação - FACIMP Cursando Metodologia do Ensino Superior - INESPO -- 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/CABcoSmCaCVpLupdcQG0kE9Cr%2B3WJyxZWSwePnzghFGvhhhN4aQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Migrating to a custom User model with South
your "myappname" is in the same directory? ex: settings.py myappname/ or settings.py apps/ myappname/ if in another directory, on INSTALLED_APPS have to are this mode "directory.myappname". 2014-09-01 12:12 GMT+01:00 Guy Tamir : > Yes its there. > Not sure if this can cause an issue but "myappname" is the main app for > my project where the settings.py file is at.. > and the CustomUser is a model inside this app > > > On Monday, September 1, 2014 1:50:20 PM UTC+3, Helton Alves wrote: > >> do you put your "myappname" in INSTALLED_APPS on settings ? >> >> >> 2014-09-01 8:17 GMT+01:00 Guy Tamir : >> >>> Hey all, >>> >>> I'm trying to create a custom User model on an existing project (Django >>> 1.5.5). >>> I followed this tutorial >>> <http://www.caktusgroup.com/blog/2013/08/07/migrating-custom-user-model-django/>, >>> I created the new model, ran a "schemamigration" once, which created >>> the tables in the DB, >>> also ran the "Migrate" command once with the copying code in the >>> "forward" method (like instructed in the tutorial in bullet no. 10. >>> >>> The new custom model table was created and all the previous users were >>> copied correctly. >>> Now, I'm trying to change the "AUTH_USER_MODEL" to newly created custom >>> User model, but when I run the migrate command I'm getting >>> this error: >>> ImproperlyConfigured: AUTH_USER_MODEL refers to model >>> 'myappname.CustomUser' that has not been installed >>> >>> I'm new to South, and this is my first time trying to work with the >>> custom User option.. >>> Not really sure how to fix this.. >>> >>> Some more details: >>> Django=1.5.5 >>> South=1.0 >>> Using Postgresql >>> >>> Thanks, >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-users...@googlegroups.com. >>> To post to this group, send email to django...@googlegroups.com. >>> >>> Visit this group at http://groups.google.com/group/django-users. >>> To view this discussion on the web visit https://groups.google.com/d/ >>> msgid/django-users/1c65a221-124a-4c24-ad96-1b7e7e44e3e8% >>> 40googlegroups.com >>> <https://groups.google.com/d/msgid/django-users/1c65a221-124a-4c24-ad96-1b7e7e44e3e8%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> >> Helton Alves >> Desenvolvedor web >> Graduado em Sistemas de Informação - FACIMP >> Cursando Metodologia do Ensino Superior - INESPO >> > -- > 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/5284fb53-300e-4c9d-8497-1ca114100ead%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/5284fb53-300e-4c9d-8497-1ca114100ead%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Helton Alves Desenvolvedor web Graduado em Sistemas de Informação - FACIMP Cursando Metodologia do Ensino Superior - INESPO -- 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/CABcoSmDmZ90EKBj1iUToy%3D8gVyTZWVFXh9ZT1wqu5co4Mrqwrw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Migrating to a custom User model with South
can you put here your full directory? 2014-09-01 12:53 GMT+01:00 Guy Tamir : > the layout is like this: > > myappname (dir): > - settings.py > - models.py (here is the CustomUser model) > > > On Monday, September 1, 2014 2:51:18 PM UTC+3, Helton Alves wrote: > >> your "myappname" is in the same directory? >> >> ex: >> settings.py >> myappname/ >> >> or >> >> settings.py >> apps/ >> myappname/ >> >> if in another directory, on INSTALLED_APPS have to are this mode >> "directory.myappname". >> >> >> 2014-09-01 12:12 GMT+01:00 Guy Tamir : >> >>> Yes its there. >>> Not sure if this can cause an issue but "myappname" is the main app for >>> my project where the settings.py file is at.. >>> and the CustomUser is a model inside this app >>> >>> >>> On Monday, September 1, 2014 1:50:20 PM UTC+3, Helton Alves wrote: >>> >>>> do you put your "myappname" in INSTALLED_APPS on settings ? >>>> >>>> >>>> 2014-09-01 8:17 GMT+01:00 Guy Tamir : >>>> >>>>> Hey all, >>>>> >>>>> I'm trying to create a custom User model on an existing project >>>>> (Django 1.5.5). >>>>> I followed this tutorial >>>>> <http://www.caktusgroup.com/blog/2013/08/07/migrating-custom-user-model-django/>, >>>>> I created the new model, ran a "schemamigration" once, which created >>>>> the tables in the DB, >>>>> also ran the "Migrate" command once with the copying code in the >>>>> "forward" method (like instructed in the tutorial in bullet no. 10. >>>>> >>>>> The new custom model table was created and all the previous users were >>>>> copied correctly. >>>>> Now, I'm trying to change the "AUTH_USER_MODEL" to newly created >>>>> custom User model, but when I run the migrate command I'm getting >>>>> this error: >>>>> ImproperlyConfigured: AUTH_USER_MODEL refers to model >>>>> 'myappname.CustomUser' that has not been installed >>>>> >>>>> I'm new to South, and this is my first time trying to work with the >>>>> custom User option.. >>>>> Not really sure how to fix this.. >>>>> >>>>> Some more details: >>>>> Django=1.5.5 >>>>> South=1.0 >>>>> Using Postgresql >>>>> >>>>> Thanks, >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Django users" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to django-users...@googlegroups.com. >>>>> To post to this group, send email to django...@googlegroups.com. >>>>> >>>>> Visit this group at http://groups.google.com/group/django-users. >>>>> To view this discussion on the web visit https://groups.google.com/d/ >>>>> msgid/django-users/1c65a221-124a-4c24-ad96-1b7e7e44e3e8%40goog >>>>> legroups.com >>>>> <https://groups.google.com/d/msgid/django-users/1c65a221-124a-4c24-ad96-1b7e7e44e3e8%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> >>>> >>>> -- >>>> >>>> Helton Alves >>>> Desenvolvedor web >>>> Graduado em Sistemas de Informação - FACIMP >>>> Cursando Metodologia do Ensino Superior - INESPO >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-users...@googlegroups.com. >>> To post to this group, send email to django...@googlegroups.com. >>> Visit this group at http://groups.google.com/group/django-users. >>> To view this discussion on the web visit https://groups.google.com/d/ >>> msgid/django-users/5284fb53-300e-4c9d-8497-1ca114100ead% >>> 40googlegroups.com >>> <https://groups.google.com/d/msgid/django-users/5284fb53-300e-4c9d-8497-1ca114100ead%40googlegroups.
Re: Migrating to a custom User model with South
why don't you put your app in your own directory? this mode is more organized. project/ settings.py views.py urls.py wsgi.py myappname/ model.py forms.py views.py urls.py 2014-09-01 13:05 GMT+01:00 Guy Tamir : > myappname(dir): > -settings.py > - admin.py > - forms.py > - models.py > - urls.py > - views.py > - wsgi.py > > > On Monday, September 1, 2014 3:02:42 PM UTC+3, Helton Alves wrote: > >> can you put here your full directory? >> >> >> 2014-09-01 12:53 GMT+01:00 Guy Tamir : >> >>> the layout is like this: >>> >>> myappname (dir): >>> - settings.py >>> - models.py (here is the CustomUser model) >>> >>> >>> On Monday, September 1, 2014 2:51:18 PM UTC+3, Helton Alves wrote: >>> >>>> your "myappname" is in the same directory? >>>> >>>> ex: >>>> settings.py >>>> myappname/ >>>> >>>> or >>>> >>>> settings.py >>>> apps/ >>>> myappname/ >>>> >>>> if in another directory, on INSTALLED_APPS have to are this mode >>>> "directory.myappname". >>>> >>>> >>>> 2014-09-01 12:12 GMT+01:00 Guy Tamir : >>>> >>>>> Yes its there. >>>>> Not sure if this can cause an issue but "myappname" is the main app >>>>> for my project where the settings.py file is at.. >>>>> and the CustomUser is a model inside this app >>>>> >>>>> >>>>> On Monday, September 1, 2014 1:50:20 PM UTC+3, Helton Alves wrote: >>>>> >>>>>> do you put your "myappname" in INSTALLED_APPS on settings ? >>>>>> >>>>>> >>>>>> 2014-09-01 8:17 GMT+01:00 Guy Tamir : >>>>>> >>>>>>> Hey all, >>>>>>> >>>>>>> I'm trying to create a custom User model on an existing project >>>>>>> (Django 1.5.5). >>>>>>> I followed this tutorial >>>>>>> <http://www.caktusgroup.com/blog/2013/08/07/migrating-custom-user-model-django/>, >>>>>>> I created the new model, ran a "schemamigration" once, which >>>>>>> created the tables in the DB, >>>>>>> also ran the "Migrate" command once with the copying code in the >>>>>>> "forward" method (like instructed in the tutorial in bullet no. 10. >>>>>>> >>>>>>> The new custom model table was created and all the previous users >>>>>>> were copied correctly. >>>>>>> Now, I'm trying to change the "AUTH_USER_MODEL" to newly created >>>>>>> custom User model, but when I run the migrate command I'm getting >>>>>>> this error: >>>>>>> ImproperlyConfigured: AUTH_USER_MODEL refers to model >>>>>>> 'myappname.CustomUser' that has not been installed >>>>>>> >>>>>>> I'm new to South, and this is my first time trying to work with the >>>>>>> custom User option.. >>>>>>> Not really sure how to fix this.. >>>>>>> >>>>>>> Some more details: >>>>>>> Django=1.5.5 >>>>>>> South=1.0 >>>>>>> Using Postgresql >>>>>>> >>>>>>> Thanks, >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "Django users" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to django-users...@googlegroups.com. >>>>>>> To post to this group, send email to django...@googlegroups.com. >>>>>>> >>>>>>> Visit this group at http://groups.google.com/group/django-users. >>>>>>> To view this discussion on the web visit >>>>>>> https://groups.google.com/d/msgid/django-users/1c65a221-124a >>>>>>> -4c24-ad96-1b7e7e44e3e8%40googlegroups.com >>>>>>> <https://groups.google.com/d/msgid/django-users/1c65a221-124a-4c24-ad96-1b7e7e44e3e8%40googlegroups.com?utm_medium=email&utm_sourc
Re: FileField open in new tab (admin)
hi brother, how are you? I think this can help you. https://github.com/texastribune/django-object-actions/issues/12 2014-09-13 22:08 GMT+01:00 Eric Tanter : > Hi, > > Is it possible to specify that a FileField, when viewed in the admin, > opens its target url in a new tab? > > 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/7cb338ac-4e32-48cd-aa7f-61ab6964a117%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/7cb338ac-4e32-48cd-aa7f-61ab6964a117%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Helton Alves Desenvolvedor web Graduado em Sistemas de Informação - FACIMP Cursando Metodologia do Ensino Superior - INESPO -- 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/CABcoSmDNgm8qwnZnSzeSFnHa6Ex-HMoqowJEuKdXCZE7k_khaw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Customise admin view
I didn't understand very well. would you like the image of the tutorial? 2014-09-18 9:59 GMT+01:00 Salvatore DI DIO : > Hello, > > I am following a 'photo application' tutorial : > http://lightbird.net/dbe/photo.html > I have created several 'albums' to insert images in. > > I would like those albums beeing displayed in the admin panel > according to each user or group > > > Thank your for your help > > regards > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/3ad874fd-9629-44e4-8cf4-0da6ac522492%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/3ad874fd-9629-44e4-8cf4-0da6ac522492%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Helton Alves Desenvolvedor web Graduado em Sistemas de Informação - FACIMP Cursando Metodologia do Ensino Superior - INESPO -- 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/CABcoSmBxd%2BLx9m9L3UK7wesjg%3DREPai%3D5csZxJ6dfSP1iZnQYg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Customise admin view
I think this will resolve your problem. :D in admin, you use the get_queryset. in this case return only items of user, you can change this for return the items that user have permission. class MyModelAdmin(admin.ModelAdmin): def queryset(self, request): qs = super(MyModelAdmin, self).queryset(request) if request.user.is_superuser: return qs return qs.filter(author=request.user) 2014-09-18 14:17 GMT+01:00 Salvatore DI DIO : > Hy Elton, > > In fact each image belongs to an album. > Let us say I have three album ALB1 ALB2 ALB3 > > In the admin form, when I add an image I can attach it to either of each > Albums > or all the three if I want > > What I would like is show the album list for a particuliar user. > > For example Tom could only add images in ALB1 >Henry could add images in ALB2 and ALB3 > > > I hope it's a little clearer > > > > > > > > Le jeudi 18 septembre 2014 14:05:13 UTC+2, Helton Alves a écrit : >> >> I didn't understand very well. >> would you like the image of the tutorial? >> >> 2014-09-18 9:59 GMT+01:00 Salvatore DI DIO : >> >>> Hello, >>> >>> I am following a 'photo application' tutorial : >>> http://lightbird.net/dbe/photo.html >>> I have created several 'albums' to insert images in. >>> >>> I would like those albums beeing displayed in the admin panel >>> according to each user or group >>> >>> >>> Thank your for your help >>> >>> regards >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-users...@googlegroups.com. >>> To post to this group, send email to django...@googlegroups.com. >>> Visit this group at http://groups.google.com/group/django-users. >>> To view this discussion on the web visit https://groups.google.com/d/ >>> msgid/django-users/3ad874fd-9629-44e4-8cf4-0da6ac522492% >>> 40googlegroups.com >>> <https://groups.google.com/d/msgid/django-users/3ad874fd-9629-44e4-8cf4-0da6ac522492%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> >> Helton Alves >> Desenvolvedor web >> Graduado em Sistemas de Informação - FACIMP >> Cursando Metodologia do Ensino Superior - INESPO >> > -- > 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/e28b8164-017e-4932-8afc-f62533b6b02d%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/e28b8164-017e-4932-8afc-f62533b6b02d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Helton Alves Desenvolvedor web Graduado em Sistemas de Informação - FACIMP Cursando Metodologia do Ensino Superior - INESPO -- 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/CABcoSmBMpio4vswwtATSBZZb-u2Q%2BDdf_ku7d%2BLAep4W-b2AJg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
change the default value choicefield
Hi guys, I'm new here on the list. I have a question. yesterday I needed create a form with some fields and one the field was using select with choicefield. I needed edit in label default of select. was as follows: I wanted like this: Your state I done like this: get the tuple with all states using the localflavor.br.br_states I have all states in STATE_CHOICES add on top of tupla like this: STATE_CHOICES = ((None, u'Your state'),) + STATE_CHOICES and then like this: state = forms.ChoiceField(choices=STATE_CHOICES, required=False) so I got what I wanted but but I think this resolution was not the best. could someone show me other resolution more elegant? -- 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/e690d4d4-03fb-43e6-b908-886ed52d295e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Creating an object using Foreign Key for Users but filtered by group
Hi brother, so, I don't know if understand very well. but I think that this is answer for your problems. https://docs.djangoproject.com/en/dev/ref/contrib/admin/ vlw. 2014-05-05 14:52 GMT+01:00 Vibhu Rishi : > Hi > > I have Users and based on some requirements, I have created a few User > Groups . e.g. I have a group of moderators. > > Now, I am trying to create a form where a normal user can message the > moderators. > > So, I have a model to be used by the form something like : > > class Message(models.Model): > moderator = models.ForeignKey(User) > user= models.ForeignKey(User) > text = models.TextField(max_length=1000) > date = models.DateField(default=datetime.now()) > > I want the moderator field to have keys to only those people who are in > the group where name='Moderator' > > I am not sure how to filter the ForeignKey in this case. > > > Why I want to do this --> is so that the form will have a dropdown list of > moderators to choose from by the user when it is displayed. User selects > the moderator, and enteres the message text - and sends it. > > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAPiONwkfs%3DcTc5dMVVKdZAeRvR0vOTz6%2B03oL1FiG_%2BumJBOeg%40mail.gmail.com<https://groups.google.com/d/msgid/django-users/CAPiONwkfs%3DcTc5dMVVKdZAeRvR0vOTz6%2B03oL1FiG_%2BumJBOeg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Helton Alves Desenvolvedor web Graduado em Sistemas de Informação - FACIMP Cursando Metodologia do Ensino Superior - INESPO -- 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/CABcoSmBRvoSWK8ueEtj8o5gfzgczq8vYnYz2-KVGVy88BwguJQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Django create userprofile
Reset your database and test again. 2014-05-12 10:46 GMT+01:00 Erik Cederstrand : > Den 12/05/2014 kl. 11.38 skrev hito koto : > > > Ok, Thank you! > > > > So, this is my the full codes; > > Are you sure your database is in sync with your model? The error message > implies that the field is defined with unique=True, but your model doesn't > define it so: > > start_work = models.ForeignKey(Staff, verbose_name = "名前") > > > Erik > > -- > 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/26954CFC-061C-4E77-80FD-EA462D2E1704%40cederstrand.dk > . > For more options, visit https://groups.google.com/d/optout. > -- Helton Alves Desenvolvedor web Graduado em Sistemas de Informação - FACIMP Cursando Metodologia do Ensino Superior - INESPO -- 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/CABcoSmB5wtm1V%3Da0_Z9jSYM88ibXwL2ywH4%3D5GhrytK-LUqT8w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Django get queryset year month day
Hi guy. so, A don't is understand very well. but the django has the generic date views, I think is exactly this. https://docs.djangoproject.com/en/dev/ref/class-based-views/generic-date-based/#module-django.views.generic.dates 2014-05-27 9:06 GMT+01:00 hito koto : > Hi, > > I want to get only year and get only month, > i want to get the only : 2005 and 05-27 > How can i to do? > > I know this : > > >>> Entry.objects.dates('pub_date', 'year')[datetime.date(2005, 1, 1)]>>> > >>> Entry.objects.dates('pub_date', 'month')[datetime.date(2005, 2, 1), > >>> datetime.date(2005, 3, 1)]>>> Entry.objects.dates('pub_date', > >>> 'day')[datetime.date(2005, 2, 20), datetime.date(2005, 3, 20)]>>> > >>> Entry.objects.dates('pub_date', 'day', order='DESC')[datetime.date(2005, > >>> 3, 20), datetime.date(2005, 2, 20)]>>> > >>> Entry.objects.filter(headline__contains='Lennon').dates('pub_date', > >>> 'day')[datetime.date(2005, 3, 20)] > > > -- > 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/f6351f85-5dbf-47f3-a475-122fb52e6fa2%40googlegroups.com<https://groups.google.com/d/msgid/django-users/f6351f85-5dbf-47f3-a475-122fb52e6fa2%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Helton Alves Desenvolvedor web Graduado em Sistemas de Informação - FACIMP Cursando Metodologia do Ensino Superior - INESPO -- 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/CABcoSmBznZKLD9uWa3nkW0-Tw6QPT7GJ8tTyS6FFYLUx-6U1Qw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Problem with runserver
> "/home/daro822/.virtualenvs/django16/local/lib/python2.7/site-packages/django/db/utils.py", > line 113, in load_backend > return import_module('%s.base' % backend_name) > File > "/home/daro822/.virtualenvs/django16/local/lib/python2.7/site-packages/django/utils/importlib.py", > line 40, in import_module > __import__(name) > File > "/home/daro822/.virtualenvs/django16/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", > line 17, in > raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) > django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No > module named MySQLdb > > > -- > 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/a4fd7e10-6032-4e68-ae65-ffd41e85c733%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/a4fd7e10-6032-4e68-ae65-ffd41e85c733%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Helton Alves Desenvolvedor web Graduado em Sistemas de Informação - FACIMP Cursando Metodologia do Ensino Superior - INESPO -- 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/CABcoSmAoa_J7GK5enOhG_anns3ZhN1OWhryCdT3iS0%3DBr4UsQA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Call for Papers for Djangocon US 2014 *extended*
If my English was better I would go in this year. :/ maybe in the next. 2014-06-30 17:21 GMT+01:00 Christophe Pettus : > Greetings, > > The Call for Papers for Djangocon US 2014 has been extended through July > 15, 2014. (The web site still shows the old date, but will be updated > shortly.) Please share what you know with us! > > http://djangocon.us/ > > Best, > -- > -- Christophe Pettus >x...@thebuild.com > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/B574574F-754C-4626-A8CF-B79CAC5AD1CE%40thebuild.com > . > For more options, visit https://groups.google.com/d/optout. > -- Helton Alves Desenvolvedor web Graduado em Sistemas de Informação - FACIMP Cursando Metodologia do Ensino Superior - INESPO -- 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/CABcoSmDQaJ%3Dzw-iHaTV1h9siMadTHX06ZwVdVdT8nP8qnsBZ0Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: what should be careful for production?
I don't know if I understand. but, look here: https://docs.djangoproject.com/en/1.5/ref/settings/#debug I think that is this that you want. 2014-07-03 18:10 GMT+01:00 : > Hello, > > An application works fine with runserver now. And then connected to WSGI. > What else should be done and be careful for production? > > And debug mode does not run with WSGI even if debug = True in settings.py. > Is that true? > > Please advice me. > > -- > 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/68c6dded-f877-4fc0-ad66-a423f46badf0%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/68c6dded-f877-4fc0-ad66-a423f46badf0%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Helton Alves Desenvolvedor web Graduado em Sistemas de Informação - FACIMP Cursando Metodologia do Ensino Superior - INESPO -- 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/CABcoSmB14sTQ3fKWZtv5qgNNjvCo2SWwXWJsXVKujYSz27OUVw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.