Re: Using input for an IntegerField

2013-12-28 Thread Cody Scott
There should be a widget to use in the 'widgets' dict. I was able to override the default of number field with a text field with the lines that are commented out. On Saturday, 28 December 2013 17:14:53 UTC-5, Daniel Roseman wrote: > > On Saturday, 28 December 2013 20:12:24

Using input for an IntegerField

2013-12-28 Thread Cody Scott
I have a model with an IntegerField and I would like to display the model form for it with a input. With the following code I get an error : 'ChoiceField' object has no attribute 'is_hidden' Here is a minimal django 1.6.1 project with the problem. https://github.com/Siecje/choice_widget/ c

How to set the email to lowercase on User Creation?

2013-07-22 Thread Cody Scott
I have a custom auth app. I am trying to only allow emails to be lower case in the database. I can create a user in the admin with Capitalized letters, even with email.lower() in the create_user method. Another solution would be to specify to the authenticate that the email can be any case. us

Re: How to Create an Auto Incrementing Integer Field

2013-07-22 Thread Cody Scott
Thank you very much, that was exactly what I was looking for. On Monday, 22 July 2013 09:48:51 UTC-4, Christian Erhardt wrote: > > Have a look at this post: > http://stackoverflow.com/questions/3123796/how-to-make-an-auto-filled-and-auto-incrementing-field-in-django-admin > > They determine the

How to Create an Auto Incrementing Integer Field

2013-07-19 Thread Cody Scott
I have a list of articles and you can control the order of the articles by changing the order field in the model order = models.IntegerField(default=1) I would like it to default to one more than the last article or one more than the largest order (since you can set the order) I can't us

Re: Submit a form but stay on the page and the form changes

2013-07-15 Thread Cody Scott
you are submitting your POST to return the data you need in JSON and use > jQuery to remove the form and add the results or url > > Sent from my Windows Phone > ------ > From: Cody Scott > Sent: 7/12/2013 11:51 PM > To: django-users@googlegroups.com >

Treebeard Hierarchical Form

2013-07-15 Thread Cody Scott
I am trying to create a hierarchical form with nodes in django-treebeard. I am using code from the docs, but it doesn't reset when I have another root node, it should be on the left side if it has a depth of 1. Also how would you make it expand when I click Products to expand products. I organi

Re: Submit a form but stay on the page and the form changes

2013-07-12 Thread Cody Scott
adding > print "form status", form.is_valid() > after string form = PollForm(request.POST, instance=self.get_object()) > > > P.S. How are you adding so nice formatting to your letter ? > > > Many thanks, > > Serge > > > +380 636150445 > skype

Submit a form but stay on the page and the form changes

2013-07-11 Thread Cody Scott
I would like to put a Poll Voting Form on any page like a blog post page or the homepage. Here is the page that I display the form and the view that it gets posted to in the form action attribute. I would like to be able to submit the form but stay on that page and have the form change into the

Writing Form Tests

2013-07-03 Thread Cody Scott
I am trying to extend the polls tutorial code to use a django form with tests. I created this form, but ran into some issues when trying to test it. When looking up how to test it, I found this form from http://toastdriven.com/blog/2011/apr/17/guide-to-testing-in-django-2/ It also had tests.

How to Test Querysets

2013-06-29 Thread Cody Scott
*I would like to be able to replace the hardcoded repr in the test with an actual queryset.* * * def test_index_view_with_a_past_poll(self): """Polls with a pub_date in the past should be displayed on the index page.""" create_poll(question="Past poll.", days=-30)

Using django tags in a blog post

2013-06-28 Thread Cody Scott
I have a simple model that has a TextField used to store a blog post. body = models.TextField() I would like to be able to use django tags in the blog post, such as {% url '' %} and {% trans "" %}. I tried using the |safe filter and passing a mark_safe() value but they don't convert the djan

Re: Allow visitor to add a form to a formset

2013-05-29 Thread Cody Scott
My issue was that I was putting my form_name in the cp['form_name-TOTAL_FORMS'] and it is always just form. -- 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 djan

Allow visitor to add a form to a formset

2013-05-29 Thread Cody Scott
I have a form with one field for emails. I would like to allow the visitor to add another email field. What do I need to do to allow the user to create another form? #following the docshttps://docs.djangoproject.com/en/1.5/topics/forms/formsets/#adding-additional-fields-to-a-formset#I don't se

Adding a search to a field.

2013-05-27 Thread Cody Scott
In the admin I have a many-to-many relationship which django supplies a default widget that is really small. I am wondering how to make that bigger or re-sizeable. Is it possible to add a search so that I can type in one of the fields and it will search by that field and bring those options to

Re: Display each language in its own language.

2013-05-24 Thread Cody Scott
ok I also had to add # -*- coding: utf-8 -*- to the top of the file On Fri, May 24, 2013 at 10:03 AM, Tom Evans wrote: > On Fri, May 24, 2013 at 2:54 PM, Cody Scott > wrote: > > In my settings.py I have > > > > #Used for translations > > > > gettext = lambd

Re: Display each language in its own language.

2013-05-24 Thread Cody Scott
x27;Japanese')), ) and I was thinking of writing each language in its own language LANGUAGES = ( ('en', gettext('English')), ('fr', gettext('Français')), ('ja', gettext('日本人')), ) But I get an error for having a non ascii characte

Display each language in its own language.

2013-05-23 Thread Cody Scott
I would like the language selector to display each language in its own language. So for example English will always be displayed as 'English'. Even if the current language is French it will still be 'English' and not Anglais. {% csrf_token %} {% for lang in LANGUAGES %}

How to locate django extension templates

2013-05-21 Thread Cody Scott
I am trying to use django-treebeard in the admin. https://tabo.pe/projects/django-treebeard/docs/tip/intro.html#configuration It says Note If you are going to use the Treeadmin class, you need to add

How to select a django-treebeard node in a form

2013-05-21 Thread Cody Scott
I have created my tree structure, now I am trying to create a form that selects a node which I will use to do some operations. When I render the form class SelectNodeForm(MoveNodeForm): class Meta: model = Category with {{form.as_p}} I get the fields Path Depth Numchild V

Trees in Django

2013-05-17 Thread Cody Scott
I am categorizing models in a tree. The tree is created based on a string of where the model falls in the tree. The tree will not change once it is created. I tried using django-mptt with this code to create the tree. def add_new_nodes(category_string): for category in category_string.split

Re: django-auth-ldap

2013-05-15 Thread Cody Scott
The problem was that the LDAPSearch had to start with a OU= I had it start with a DC=. On Wednesday, 15 May 2013 11:27:08 UTC-4, Cody Scott wrote: > > I have that code but where does the logging go? > > On Wednesday, 15 May 2013 11:04:33 UTC-4, Guddu wrote: >> >> Ok. No

Re: django-auth-ldap

2013-05-15 Thread Cody Scott
ap/logging.html > > Regards > Guddu > > On Wed, May 15, 2013 at 10:56 AM, Cody Scott > > > wrote: > >> Ok The problem was that I had the file named ldap.py. I got it to work, I >> had to add a print to >> >> l.result(result) >> >> put I ge

Re: django-auth-ldap

2013-05-15 Thread Cody Scott
Ok The problem was that I had the file named ldap.py. I got it to work, I had to add a print to l.result(result) put I get a tuple of a number and an empty list (#, []) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from t

Re: django-auth-ldap

2013-05-15 Thread Cody Scott
http://dpaste.org/EboQU/ On Wednesday, 15 May 2013 10:09:01 UTC-4, Guddu wrote: > > What does this give you? > > import ldap > dir(ldap) > > Regards > Guddu > > On Wed, May 15, 2013 at 10:04 AM, Cody Scott > > > wrote: > >> I put that code in a s

Re: django-auth-ldap

2013-05-15 Thread Cody Scott
I put that code in a separate python file and ran it without django or django-auth-ldap. l = ldap.initialize() AttributeError: 'module' object has no attribute 'initialize' so python-ldap is not installed properly? I am not able to login, no error just invalid credentials. How do I get logs

Re: django-auth-ldap

2013-05-14 Thread Cody Scott
Do I need to set up groups? I have a setting for AUTH_LDAP_SERVER_URI AUTH_LDAP_BIND_DN AUTH_LDAP_BIND_PASSWORD AUTH_LDAP_USER_SEARCH AUTH_LDAP_USER_ATTR_MAP = { "username": "sAMAccountName", "email": "mail" } I am using a custom auth model. Maybe that is the reason it is not working?

django-auth-ldap

2013-05-14 Thread Cody Scott
I am trying to get django-auth-ldap working with an Active Directory LDAP Server. I don't understand the documentation for the Search/Bind or Direct Bind. Is 'uid' the LDAP attribute uid? My LDAP doesn't use this attribute. I tried putting 'samaccountName' an attribute that is used for logon.

Re: Customizing Admin

2013-05-09 Thread Cody Scott
wrote: > I think you can customize the django admin templates for your own purpose > > > 2013/5/7 Cody Scott > >> Is there a way to put text in the django admin? >> >> I am trying to display information from another model, to help in your >> select of F

Customizing Admin

2013-05-07 Thread Cody Scott
Is there a way to put text in the django admin? I am trying to display information from another model, to help in your select of ForeignKeys. Right now I am adding this information to the __unicode__ function so I can see the information but there is not context. Also is there a way to make a

How to create a Dynamic Hierarchical Form

2013-04-22 Thread Cody Scott
I am trying to create a form where you select product(s) and technology(s) and based on your selection different modules are available for selection. forms.py def make_quiz_form_class(): #Listing available options products = [(i, _(i)) for i in Product.objects.all()] technologies

Re: How to switch languages?

2013-04-22 Thread Cody Scott
UTC-4, אברהם סרור wrote: > > I suggest taking a look at > django-localeurl<https://bitbucket.org/carljm/django-localeurl>, > I used it instead of a form to change language on my last project. I > believe it is worth taking a look > > > On Mon, Apr 22, 2013 at 6:58

Re: How to switch languages?

2013-04-22 Thread Cody Scott
1.4/topics/i18n/translation/#how-django-discovers-language-preference). > > I normally set django_language session variable to the preferred language. > For 1), have you compiled your messages into .mo files? You will also need > to reload your server to load the new .mo files. > >

How to switch languages?

2013-04-22 Thread Cody Scott
I am trying to get translations to work on my site. I have marked words for translation and they show up in the django.po file. I am wondering what is the proper way to switch the current language. Currently I have the following in my project urls.py urlpatterns = i18n_patterns('', # et

Re: How to translate database content?

2013-04-19 Thread Cody Scott
;> on the matter (I have not tried any personally), your own Google search >> will be as good as mine. But look for things along the line of "django >> model translation". >> >> Hope this helps. >> >> On Tuesday, April 16, 2013 9:15:40 AM UTC-7, Cody

Re: How to add Django project to sys.path?

2013-04-19 Thread Cody Scott
.fandrade.com.br/ > --- > Cel: (16) 8121-5290 / 9718-3939 > Tel: (16) 3371-7274 > Skype: fbruandrade > MSN: felipean...@hotmail.com > ICQ: 15909761 > --- > > > > 2013/4/19 Cody Scott > > &

How to add Django project to sys.path?

2013-04-19 Thread Cody Scott
I am trying to use apache to serve my development site locally. I am trying to implement download functionality and figured since it was best done through a web server that I would just serve the with apache from now on. Is this recommended to start using your django site with a web server earl

Random translation text showing up while the rest is not translated.

2013-04-18 Thread Cody Scott
I have marked text for translation, and also database content with the dbgettext mdoule. So I do: syncdb add some content dbgettext_export makemessages -l ja add all of the translations compilemessages Then I change the /en/ to /ja/ to see the page in Japanese, but only two things are transl

Re: How to view your translated site?

2013-04-18 Thread Cody Scott
I agree that link is much better, I got the other one from settings.py On Thu, Apr 18, 2013 at 12:41 PM, Tom Evans wrote: > On Thu, Apr 18, 2013 at 5:23 PM, Cody Scott > wrote: > > Thanks, I went here > http://www.i18nguy.com/unicode/language-identifiers.html > > ctrl+ f

Re: How to view your translated site?

2013-04-18 Thread Cody Scott
Thanks, I went here http://www.i18nguy.com/unicode/language-identifiers.html ctrl+ f "japanese" saw jp on the left hand side. I thought ja was a localization of jp so it would be jp-ja. On Thursday, 18 April 2013 11:42:37 UTC-4, Cody Scott wrote: > > I am trying to view my sit

How to view your translated site?

2013-04-18 Thread Cody Scott
I am trying to view my site in japanese. I have create the translations and compiled them with compilemessages. In my urls.py I have urlpatterns = i18n_patterns('', #...) Settings.py LANGUAGE_CODE = 'en-us' #Used for translationsgettext = lambda s: sLANGUAGES = ( ('en', gettext('Eng

How to translate database content?

2013-04-16 Thread Cody Scott
I want the end user of the site to be able to view the site in different languages. I have marked the static text in my templates for translation. I have not marked the verbose_names because they are used in the admin which the end user will not have access to. But I just realized that the act

How to clear all session variables without getting logged out?

2013-04-16 Thread Cody Scott
I am trying to clear all of the session variables but not logout the current user. user = request.session.get('member_id', None) request.session.flush() request.session.modified = True request.session['member_id'] = user request.session.modified = True Will this also affect

Re: How to use a list in a django model

2013-04-10 Thread Cody Scott
ls.ManyToManyField(Question) created_by = models.ForeignKey(settings.AUTH_USER_MODEL, related_name="quizzes") #questions = models.ManyToManyField(QuestionManager, null=True, related_name="quiz") class Meta: verbose_name_plural = "quizzes" def __unicode__(self):

Re: How to use a list in a django model

2013-04-10 Thread Cody Scott
that I can set Choices for a Question when I am making a Quiz? On Wednesday, 10 April 2013 13:38:14 UTC-4, Cody Scott wrote: > > I am trying to store questions in a database. > I don't to set a fixed number of options for the question, some questions > could have 4 or 2 or 5.

Re: How to use a list in a django model

2013-04-10 Thread Cody Scott
w is duplicate a question, edit on a single page, > hit save. > > Brian Schott > bfsc...@gmail.com > > > > On Apr 10, 2013, at 3:02 PM, Cody Scott > > wrote: > > I like the is_correct and the count attributes! > > The problem with that it is hard to make

Re: How to use a list in a django model

2013-04-10 Thread Cody Scott
m/derek-schaefer/django-json-field > > 3. There are several flavors of ListField out there: > http://djangosnippets.org/snippets/1491/ > > > > Brian Schott > bfsc...@gmail.com > > > > On Apr 10, 2013, at 1:38 PM, Cody Scott > > wrote: > >

How to use a list in a django model

2013-04-10 Thread Cody Scott
I am trying to store questions in a database. I don't to set a fixed number of options for the question, some questions could have 4 or 2 or 5. Currently I am using a ManyToManyField to a table that just contains a CharField. This works but creating an option requires making another Choice objec

Can't get Save method to work

2013-04-09 Thread Cody Scott
I have a Question Model with a ForeignKey field (answer) and a ManyToManyField (choices) that link to the same model (Choice). When I create a question I create a new Choice object for the answer field but that option does not show up for the choices field. I don't want to have to cancel the cr

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
n or not is > going to check if you are active and superuser. > > # Active superusers have all permissions. > if self.is_active and self.is_superuser: > return True > > > On Tue, Apr 9, 2013 at 9:46 AM, Cody Scott > > wrote: > >> If I don't h

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
f.is_active and self.is_superuser: > return True > > > On Tue, Apr 9, 2013 at 9:46 AM, Cody Scott wrote: > >> If I don't have them and I log in to admin I get >> "You don't have permission to edit anything." >> >> >> On Tue, Apr 9, 2013 a

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
gt; https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#auth-custom-user > > Do not override those methods otherwise all users will return always true. > > > On Tue, Apr 9, 2013 at 9:22 AM, Cody Scott wrote: > >> In the docs >> https://docs.djangoproject.

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
perms(self, app_label): return True On Tue, Apr 9, 2013 at 11:05 AM, Cody Scott wrote: > In models.py in /django/contrib/auth there is a > > u.is_superuser = True > > but when I add it just like how is_staff and is_active are added I get the > error > > "Fie

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
PermissionsMixin' " On Monday, 8 April 2013 11:09:29 UTC-4, Cody Scott wrote: > > To create a User object you need to have a unique username. > > I would like to use an email and a password to identify users, since an > email is already required for my site's funct

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
Except the super user I created with syncdb doesn't have access to anything On Tuesday, 9 April 2013 10:24:19 UTC-4, Cody Scott wrote: > > Thank you that was my issue. Now syncdb works I also needed to add a name > parameter to create_superuser and create_user and make sure create

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
our module/app is 'mysite' and you have defined 'Users' > class in 'mysite/models.py', then your settings.AUTH_USER_MODEL should be > 'mysite.Users' > > > On Tue, Apr 9, 2013 at 4:52 PM, Cody Scott > > wrote: > >> I placed the

Re: Why is a username required for a User?

2013-04-09 Thread Cody Scott
itial["password"] > > class MyUserAdmin(UserAdmin): > form = UserChangeForm > add_form = UserCreationForm > > list_display = ('email', 'is_admin') > list_filter = ('is_admin',) > fieldsets = ( >

Re: Why is a username required for a User?

2013-04-08 Thread Cody Scott
Yes I am using Django 1.5 On Monday, 8 April 2013 11:11:57 UTC-4, Anderson Borges wrote: > > Hey Cody are using django 1.5? > > > On Mon, Apr 8, 2013 at 9:09 AM, Cody Scott > > wrote: > >> To create a User object you need to have a unique username. >> &

Why is a username required for a User?

2013-04-08 Thread Cody Scott
To create a User object you need to have a unique username. I would like to use an email and a password to identify users, since an email is already required for my site's functionality. It seems silly for a framework so restrict you. -- You received this message because you are subscribed to

Why is there no view for sign up in django.contrib.auth.views?

2013-04-05 Thread Cody Scott
If I want users to sign up for my site, I need to make a register view, register form and a register template. Why is there a view and form for every other user account action (login, logout, etc.) -- You received this message because you are subscribed to the Google Groups "Django users" gr

Re: How to create a form list for a Model Form dynamically?

2013-04-03 Thread Cody Scott
ow at first. > > Is this line wrong "quiz = Quiz.objects.get(id=quiz_id)"? > > I don't think Django names the pk "id" by default. Maybe it should be: > > quiz = Quiz.objects.get(pk=quiz_id) > > On Monday, April 1, 2013 7:17:13 AM UTC-7, Cody Scot

Re: How to create a form list for a Model Form dynamically?

2013-04-03 Thread Cody Scott
The function I was calling there was in the urls.py file and it only took one parameter. I tried it again and with passing request and it still says quiz_id is unknown... On Monday, April 1, 2013 10:17:13 AM UTC-4, Cody Scott wrote: > > I am trying to make a simple quiz app. > > I

How to create a form list for a Model Form dynamically?

2013-04-01 Thread Cody Scott
I am trying to make a simple quiz app. I am trying to go to the URL /quiz/ and using the quiz_id which has a list of questions associated with the quiz id and create a list of forms to use in the model form. In the urls.py file I know you can pass a list of forms to be used, but I need to crea

Can't create an object with a foreign key

2013-03-19 Thread Cody Scott
I get the error when I try to make an object. Cannot assign "u'Category object'": "Course.category" must be a "Category" > instance. here is my admin form admin.py admin.site.register(Category, list_display = ('name',)) CATEGORIES = [(category, category.name) for category in Category.objects

Can't make an object with a foreign key

2013-03-19 Thread Cody Scott
Can't make an object with a foreign key. When I submit it says Cannot assign "u'Category object'": "Course.category" must be a "Category" > instance. > Here is my admin form admin.py > admin.site.register(Category, list_display = ('name',)) > CATEGORIES = [(category, category.name) for ca