Search Results

Search found 5330 results on 214 pages for 'django auth'.

Page 13/214 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • MultiWidget in MultiWidget how to compress the first one?

    - by sacabuche
    I have two MultiWidget one inside the other, but the problem is that the MultiWidget contained don't return compress, how do i do to get the right value from the first widget? In this case from SplitTimeWidget class SplitTimeWidget(forms.MultiWidget): """ Widget written to split widget into hours and minutes. """ def __init__(self, attrs=None): widgets = ( forms.Select(attrs=attrs, choices=([(hour,hour) for hour in range(0,24)])), forms.Select(attrs=attrs, choices=([(minute, str(minute).zfill(2)) for minute in range(0,60)])), ) super(SplitTimeWidget, self).__init__(widgets, attrs) def decompress(self, value): if value: return [value.hour, value.minute] return [None, None] class DateTimeSelectWidget (forms.MultiWidget): """ A widget that splits date into Date and Hours, minutes, seconds with selects """ date_format = DateInput.format def __init__(self, attrs=None, date_format=None): if date_format: self.date_format = date_format #if time_format: # self.time_format = time_format hours = [(hour,str(hour)+' h') for hour in range(0,24)] minutes = [(minute,minute) for minute in range(0,60)] seconds = minutes #not used always in 0s widgets = ( DateInput(attrs=attrs, format=self.date_format), SplitTimeWidget(attrs=attrs), ) super(DateTimeSelectWidget,self).__init__(widgets, attrs) def decompress(self, value): if value: return [value.date(), value.time()] else: [None, None, None]

    Read the article

  • extending satchmo user profile

    - by z3a
    I'm trying to extend the basic user registration form and profile included in satchmo store, but I'm in problems with that. This what I've done: Create a new app "extendedprofile" Wrote a models.py that extends the satchmo_store.contact.models class and add the custom name fields. wrote an admin.py that unregister the Contact class and register my newapp but this still showing me the default user profile form. Maybe some one can show me the correct way to do this?

    Read the article

  • Using a custom form in a modelformset factory?

    - by jamida
    I'd like to be able to use a customized form in a modelformset_factory. For example: models.py class Author(models.Model): name = models.CharField() address = models.CharField() class AuthorForm(ModelForm): class Meta: model = Author views.py def test_render(request): myModelFormset = modelformset_factory(Author) items = Author.objects.all() formsetInstance = myModelFormset(queryset = items) return render_to_response('template',locals()) The above code works just fine, but note I'm NOT using AuthorForm. The question is how can I get the modelformset_factory to use the AuthorForm (which I plan to customize later) instead of making a default Author form?

    Read the article

  • Form for Profile models ?

    - by xRobot
    Is there a way to create a form from profile models ? For example... If I have this model as profile: class blogger(models.Model): user = models.ForeignKey(User, unique=True) born = models.DateTimeField('born') gender = models.CharField(max_length=1, choices=gender ) about = models.TextField(_('about'), null=True, blank=True) . I want this form: Name: Surname: Born: Gender: About: Is this possible ? If yes how ?

    Read the article

  • Where to delete model image?

    - by WesDec
    I have a Model with an image field and I want to be able to change the image using a ModelForm. When changing the image, the old image should be deleted and replaced by the new image. I have tried to do this in the clean method of the ModelForm like this: def clean(self): cleaned_data = super(ModelForm, self).clean() old_profile_image = self.instance.image if old_profile_image: old_profile_image.delete(save=False) return cleaned_data This works fine unless the file indicated by the user is not correct (for example if its not an image), which result in the image being deleted without any new images being saved. I would like to know where is the best place to delete the old image? By this I mean where can I be sure that the new image is correct before deleting the old one?

    Read the article

  • How to set multiple permissions in one class view, depending on http request

    - by andrew13331
    How can I change the permissions depending on if it is a get or a post. Is it possible to do it in one class or would I have to separate it out into two classes? If its a get I want "permission_classes = (permissions.IsAuthenticated)" and if its a post I want "permission_classes = (permissions.IsAdminUser)" class CategoryList(generics.ListCreateAPIView): queryset = QuestionCategory.objects.all() serializer_class = QuestionCategorySerializer permission_classes = (permissions.IsAuthenticated,)

    Read the article

  • Why is django giving me an attribute error when I call _set.all() for its children models?

    - by user1876508
    I have two models defined from django.db import models class Blog(models.Model): title = models.CharField(max_length=144) @property def posts(self): self.Post_set.all() class Post(models.Model): title = models.CharField(max_length=144) text = models.TextField() blog = models.ForeignKey('Blog') but the problem is, when I run shell, and enter >>> blog = Blog(title="My blog") >>> post = Post(title="My first post", text="Here is the main text for my blog post", blog=blog) >>> blog.posts I get the error Traceback (most recent call last): File "<console>", line 1, in <module> File "/home/lucas/Programming/Python/Django/djangorestfun/blog/models.py", line 9, in posts self.Post_set.all() AttributeError: 'Blog' object has no attribute 'Post_set' >>> Now I am having the following problem >>> from blog.models import * >>> blog = Blog(title="gewrhter") >>> blog.save() >>> blog.__dict__ {'_state': <django.db.models.base.ModelState object at 0x259be10>, 'id': 1, 'title': 'gewrhter'} >>> blog._state.__dict__ {'adding': False, 'db': 'default'} >>> post = Post(title="sdhxcvb", text="hdbfdgb", blog=blog) >>> post.save() >>> post.__dict__ {'blog_id': 1, 'title': 'sdhxcvb', 'text': 'hdbfdgb', '_blog_cache': <Blog: Blog object>, '_state': <django.db.models.base.ModelState object at 0x259bed0>, 'id': 1} >>> blog.posts >>> print blog.posts None Second update So I followed your guide, but I am still getting nothing. In addition, blog.posts gives me an error. >>> from blog.models import * >>> blog = Blog(title="asdf") >>> blog.save() >>> post = Post(title="asdf", text="sdxcvb", blog=blog) >>> post.save() >>> blog.posts Traceback (most recent call last): File "<console>", line 1, in <module> AttributeError: 'Blog' object has no attribute 'posts' >>> print blog.all_posts None

    Read the article

  • Is it possible to change the model name in the django admin site?

    - by luc
    Hello, I am translating a django app and I would like to translate also the homepage of the django admin site. On this page are listed the application names and the model class names. I would like to translate the model class name but I don't find how to give a user-friendly name for a model class. Does anybody know how to do that?

    Read the article

  • How can I run .aggregate() on a field introduced using .extra(select={...}) in a Django Query?

    - by Jake
    I'm trying to get the count of the number of times a player played each week like this: player.game_objects.extra(select={'week': 'WEEK(`games_game`.`date`)'}).aggregate(count=Count('week')) But Django complains that FieldError: Cannot resolve keyword 'week' into field. Choices are: <lists model fields> I can do it in raw SQL like this SELECT WEEK(date) as week, COUNT(WEEK(date)) as count FROM games_game WHERE player_id = 3 GROUP BY week Is there a good way to do this without executing raw SQL in Django?

    Read the article

  • django-social-auth for Facebook is redirecting home and not logging in

    - by Scott Rogowski
    I have had django-social-auth working for Google for quite some time now but am having problems with Facebook. I am at the point where clicking on the /login/facebook/ link will take me to the Facebook authorization page. I then click "go to app" and it redirects me to my home page but does not log in or create a user but does put some strange "#=" onto the back of my URL. Reading up on that, here https://developers.facebook.com/blog/post/552/, and here https://github.com/omab/django-social-auth/issues/199, it seems that would be happening if the redirect uri was not defined. However, on my facebook app settings, I have the following (replacing my site with example.com): + App Namespace: "example" + Site URL: "http://example.com/complete/facebook/" + Site Domain: "example.com" + Sandbox Mode: "On" + Post-Authorize Redirect URL: "http://apps.facebook.com/example/" + Deauthorize URL: "http://www.example.com/" + Post-Authorize URL: "http://example.com/complete/facebook/" The request that django-social-auth is sending to facebook is (replacing my info again): "https://www.facebook.com/dialog/oauth?scope=email&state=*&redirect_uri=http%3A%2F%2Fexample.com%2Fcomplete%2Ffacebook%2F%3Fredirect_state%3D***&client_id=*" The /complete/facebook/ is what is in the documentation and google works as /complete/google/ What am I missing here?

    Read the article

  • How can I download django-1.2 and use it across multiple sites when the system default is 1.1?

    - by meder
    I'm on Debian Lenny and the latest backports django is 1.1.1 final. I don't want to use sid so I probably have to download django. I have my sites located at: /www/ and I plan on using mod_wsgi with Apache2 as a reverse proxy from nginx. Now that I downloaded pip and virtualenv through pip, can someone explain how I could get my /www/ sites which are yet to be made to all use django-1.2? Question 1.1: Where do you suggest I download django-1.2? I know you can store it anywhere but where would you store it? Question 1.2: After installing it how do you actually tie that django-1.2 instead of the system default django 1.2 to the reverse proxied Apache conf? I would prefer it if answers were more specific than vague and have examples of setups.

    Read the article

  • WISiWYG with uploading pictures: Django way

    - by valya
    Hello! I'm trying to integrate TinyMCE or CKEditor into Django, but I have no idea how to manage uploading pictures. I've been searching and found some django apps, but they won't work with my Django version (1.1.1), buggy and not maintained. Maybe I missed something? Can you please give me a step-by-step guide how to add WYSIWYG with uploading into django form?

    Read the article

  • djnago-multilingual-ng / Django 1.1.1 incompatibility?

    - by omat
    I am getting "cannot import name connections" exception while trying to use django-multilingual-ng 0.1.20 with Django 1.1.1. The exception comes from the line 15 of query.py where it tries to: from django.db import connections, DEFAULT_DB_ALIAS Is it not compatible with Django 1.1.1? Does anybody tried this combination and have any suggestions? Thanks. -- oMat

    Read the article

  • Extending Django Flatpages to accept template tags

    - by Tristan
    I use django flatpages for a lot of content on our site, I'd like to extend it to accept django template tags in the content as well. I found this snippet but after much larking about I couldn't get it to work. Am I correct in assuming that you would need too "subclass" the django flatpages app to get this to work? Is this best way of doing it? I'm not quite sure how to structure it, as I don't really want to directly modify the django distribution.

    Read the article

  • Django ModelFormSet with Google app engine

    - by Eric
    I'm using Django with google app engine. I'm using the google furnished django app engine helper project. I'm attempting to create a Django modelformset like this: #MyModel inherits from BaseModel MyFormSet = modelformset_factory(models.MyModel) However, it's failing with this error: 'ModelOptions' object has no attribute 'fields' Apparently modelformset_factory() is expecting MyModel to implement a 'fields' accessor. Anybody successfully used a modelformset with GAE datastore? Or is this a fundamental incompatibility between Django and GAE?

    Read the article

  • Django - I got TemplateSyntaxError when I try open the admin page. (http://DOMAIN_NAME/admin)

    - by user140827
    I use grappelly plugin. When I try open the admin page (/admin) I got TemplateSyntaxError. It says 'get_generic_relation_list' is invalid block tag. TemplateSyntaxError at /admin/ Invalid block tag: 'get_generic_relation_list', expected 'endblock' Request Method: GET Request URL: http://DOMAIN_NAME/admin/ Django Version: 1.4 Exception Type: TemplateSyntaxError Exception Value: Invalid block tag: 'get_generic_relation_list', expected 'endblock' Exception Location: /opt/python27/django/1.4/lib/python2.7/site-packages/django/template/base.py in invalid_block_tag, line 320 Python Executable: /opt/python27/django/1.4/bin/python Python Version: 2.7.0 Python Path: ['/home/vhosts/DOMAIN_NAME/httpdocs/media', '/home/vhosts/DOMAIN_NAME/private/new_malinnikov/lib', '/home/vhosts/DOMAIN_NAME/httpdocs/', '/home/vhosts/DOMAIN_NAME/private/new_malinnikov', '/home/vhosts/DOMAIN_NAME/private/new_malinnikov', '/home/vhosts/DOMAIN_NAME/private', '/opt/python27/django/1.4', '/home/vhosts/DOMAIN_NAME/httpdocs', '/opt/python27/django/1.4/lib/python2.7/site-packages/setuptools-0.6c12dev_r88846-py2.7.egg', '/opt/python27/django/1.4/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg', '/opt/python27/django/1.4/lib/python27.zip', '/opt/python27/django/1.4/lib/python2.7', '/opt/python27/django/1.4/lib/python2.7/plat-linux2', '/opt/python27/django/1.4/lib/python2.7/lib-tk', '/opt/python27/django/1.4/lib/python2.7/lib-old', '/opt/python27/django/1.4/lib/python2.7/lib-dynload', '/opt/python27/lib/python2.7', '/opt/python27/lib/python2.7/plat-linux2', '/opt/python27/lib/python2.7/lib-tk', '/opt/python27/django/1.4/lib/python2.7/site-packages', '/opt/python27/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', '/opt/python27/lib/python2.7/site-packages/flup-1.0.3.dev_20100525-py2.7.egg', '/opt/python27/lib/python2.7/site-packages/virtualenv-1.5.1-py2.7.egg', '/opt/python27/lib/python2.7/site-packages/SQLAlchemy-0.6.4-py2.7.egg', '/opt/python27/lib/python2.7/site-packages/SQLObject-0.14.1-py2.7.egg', '/opt/python27/lib/python2.7/site-packages/FormEncode-1.2.3dev-py2.7.egg', '/opt/python27/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-linux-x86_64.egg', '/opt/python27/lib/python2.7/site-packages/psycopg2-2.2.2-py2.7-linux-x86_64.egg', '/opt/python27/lib/python2.7/site-packages/pysqlite-2.6.0-py2.7-linux-x86_64.egg', '/opt/python27/lib/python2.7/site-packages', '/opt/python27/lib/python2.7/site-packages/PIL'] Server time: ???, 7 ??? 2012 04:19:42 +0700 Error during template rendering In template /home/vhosts/DOMAIN_NAME/httpdocs/templates/grappelli/admin/base.html, error at line 28 Invalid block tag: 'get_generic_relation_list', expected 'endblock' 18 <!--[if lt IE 8]> 19 <script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script> 20 <![endif]--> 21 {% block javascripts %} 22 <script type="text/javascript" src="{% admin_media_prefix %}jquery/jquery-1.3.2.min.js"></script> 23 <script type="text/javascript" src="{% admin_media_prefix %}js/admin/Bookmarks.js"></script> 24 <script type="text/javascript"> 25 // Admin URL 26 var ADMIN_URL = "{% get_admin_url %}"; 27 // Generic Relations 28 {% get_generic_relation_list %} 29 // Get Bookmarks 30 $(document).ready(function(){ 31 $.ajax({ 32 type: "GET", 33 url: '{% url grp_bookmark_get %}', 34 data: "path=" + escape(window.location.pathname + window.location.search), 35 dataType: "html", 36 success: function(data){ 37 $('ul#bookmarks').replaceWith(data); 38 }

    Read the article

  • django-registration password reset custom template not loading

    - by ip.
    I'm using django-registration for registering users, however when I want to use my own template for password reset I get the admin template and not the template I created. My template is in myapp/templates/registration/password_reset_form.html and my template loaders are properly set: TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ) What could I be missing? I'm using Django 1.4

    Read the article

  • Learning django by example source code (not examples)

    - by Bryce
    I'm seeking a nice complete open source django application to study and learn best practices from, or even use as a template. The tutorials only go so far, and django is super flexible which can lead one to paining themselves into a corner. Ideally such a template / example would: Ignore django admin, and implement full CRUD outside the admin. Be built like a large application in terms of best practices and patterns. Have a unit test Use at least one package (e.g. twitter integration or threaded comments) Implement some AJAX or Comet See also: Learning Django by example

    Read the article

  • Visual web page designer for Django?

    - by Robert Oschler
    I'm just starting my Django learning so pardon me if any part of this question is off-base. I have done a lot of web searching for information on the equivalent of a visual web page designer for Django and I don't seem to be getting very far. I have experience with Delphi (Object Pascal), C, C++, Python, PHP, Java, and Javascript and have created and maintained several web sites that included MySQL database dependent content. For the longest time I've been using one of the standard WYSIWIG designers to design the actual web pages, with any needed back end programming done via Forms or AJAX calls that call server side PHP scripts. I have grown tired of the quirks, bugs, and other annoyances associated with the program. Also, I find myself hungry for the functionality and reliability a good MVC based framework would provide me so I could really express myself with custom code easily. So I am turning to Django/Python. However, I'm still a junkie for a good WYSIWIG designer for the layout of web pages. I know there are some out there that thrive on opening up a text editor, possibly with some code editor tools to assist, and pounding out pages. But I do adore a drag and drop editor for simple page layout, especially for things like embedded images, tables, buttons, etc. I found a few open source projects on GitHub but they seem to be focused on HTML web forms, not a generic web page editor. So can I get what I want here? The supreme goal would be to find not only a web page editor that creates Django compatible web pages, but if I dare say it, have a design editor that could add Python code stubs to various page elements in the style of the Delph/VCL or VB design editors. Note, I also have the Wing IDE Professional IDE, version 2.0. As a side note, if you know of any really cool, fun, or time-saving Python libraries that are designed for easy integration into Django please tell me about them. -- roschler

    Read the article

  • Does this syntax for specifying Django conditional form display align with python/django convention?

    - by andy
    I asked a similar question on Stackoverflow and was told it was better asked here. So I'll ask it slightly rephrased. I am working on a Django project, part of which will become a distributable plugin that allows the python/django developer to specify conditional form field display logic in the form class or model class. I am trying to decide how the developer must specify that logic. Here's an example: class MyModel(models.Model): #these are some django model fields which will be used in a form yes_or_no = models.SomeField...choices are yes or no... why = models.SomeField...text, but only relevant if yes_or_no == yes... elaborate_even_more = models.SomeField...more text, just here so we can have multiple conditions #here i am inventing some syntax...i am looking for suggestions!! #this is one possibility why.show_if = ('yes_or_no','==','yes') elaborate_even_more.show_if = (('yes_or_no','==','yes'),('why','is not','None')) #help me choose a syntax that is *easy*...and Pythonic and...Djangonic...and that makes your fingers happy to type! #another alternative... conditions = {'why': ('yes_or_no','==','yes'), 'elaborate_even_more': (('yes_or_no','==','yes'),('why','is not','None')) } #or another alternative... """Showe the field whiche hath the name *why* only under that circumstance in whiche the field whiche hath the name *yes_or_no* hath the value *yes*, in strictest equality.""" etc... Those conditions will be eventually passed via django templates to some javascript that will show or hide form fields accordingly. Which of those options (or please propose a better option) aligns better with conventions such that it will be easiest for the python/django developer to use? Also are there other considerations that should impact what syntax I choose?

    Read the article

  • Rebuilding website from Django 0.96 to Django 1.2

    - by Neytiri
    I've got a website done in Django 0.96 (done in 2007), and now we are thinking about rebuilding it (not just migrating) for Django 1.2 . Can anyone point me to the new (and worth the while) widgets, plugins and other stuff for Django 1.2 (released in april 2010). I've heard of "South" and of a widget for debugging (can't remember the name), but I'm a little lost here.

    Read the article

  • Why use Django on Google App Engine?

    - by Travis Bradshaw
    When researching Google App Engine (GAE), it's clear that using Django is wildly popular for developing in Python on GAE. I've been scouring the web to find information on the costs and benefits of using Django, to find out why it's so popular. While I've been able to find a wide variety of sources on how to run Django on GAE and the various methods of doing so, I haven't found any comparative analysis on why Django is preferable to using the webapp framework provided by Google. To be clear, it's immediately apparent why using Django on GAE is useful for developers with an existing skillset in Django (a majority of Python web developers, no doubt) or existing code in Django (where using GAE is more of a porting exercise). My team, however, is evaluating GAE for use on an all-new project and our existing experience is with TurboGears, not Django. It's been quite difficult to determine why Django is beneficial to a development team when the BigTable libraries have replaced Django's ORM, sessions and authentication are necessarily changed, and Django's templating (if desirable) is available without using the entire Django stack. Finally, it's clear that using Django does have the advantage of providing an "exit strategy" if we later wanted to move away from GAE and need a platform to target for the exodus. I'd be extremely appreciative for help in pointing out why using Django is better than using webapp on GAE. I'm also completely inexperienced with Django, so elaboration on smaller features and/or conveniences that work on GAE are also valuable to me. Thanks in advance for your time!

    Read the article

  • Django vs GAE + Django vs GAE + other framework

    - by Ilian Iliev
    I`m looking for opinion which one is better for building web applications(web sites). I have some experience with Django, and some with Google App Engine and App-Engine-Patch for Django. And it seems to me that only Django is working faster than the GAE implementation. Is there some other frameworks that simplify the developments process, providing forms creating, user management, url resolving etc. Thanks in advance, Ilian Iliev P.S. I am also interested in GAE and webapp framework case

    Read the article

  • Google App Engine + Form Validation

    - by Iwona
    Hi, I would like to do google app engine form validation but I dont know how to do it? I tried like this: from google.appengine.ext.db import djangoforms from django import newforms as forms class SurveyForm(forms.Form): occupations_choices = ( ('1', ""), ('2', "Undergraduate student"), ('3', "Postgraduate student (MSc)"), ('4', "Postgraduate student (PhD)"), ('5', "Lab assistant"), ('6', "Technician"), ('7', "Lecturer"), ('8', "Other" ) ) howreach_choices = ( ('1', ""), ('2', "Typed the URL directly"), ('3', "Site is bookmarked"), ('4', "A search engine"), ('5', "A link from another site"), ('6', "From a book"), ('7', "Other") ) boxes_choices = ( ("des", "Website Design"), ("svr", "Web Server Administration"), ("com", "Electronic Commerce"), ("mkt", "Web Marketing/Advertising"), ("edu", "Web-Related Education") ) name = forms.CharField(label='Name', max_length=100, required=True) email = forms.EmailField(label='Your Email Address:') occupations = forms.ChoiceField(choices=occupations_choices, label='What is your occupation?') howreach = forms.ChoiceField(choices=howreach_choices, label='How did you reach this site?') # radio buttons 1-5 rating = forms.ChoiceField(choices=range(1,6), label='What is your occupation?', widget=forms.RadioSelect) boxes = forms.ChoiceField(choices=boxes_choices, label='Are you involved in any of the following? (check all that apply):', widget=forms.CheckboxInput) comment = forms.CharField(widget=forms.Textarea, required=False) And I wanted to display it like this: template_values = { 'url' : url, 'url_linktext' : url_linktext, 'userName' : userName, 'item1' : SurveyForm() } And I have this error message: Traceback (most recent call last): File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp_init_.py", line 515, in call handler.get(*groups) File "C:\Program Files\Google\google_appengine\demos\b00213576\main.py", line 144, in get self.response.out.write(template.render(path, template_values)) File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\template.py", line 143, in render return t.render(Context(template_dict)) File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\template.py", line 183, in wrap_render return orig_render(context) File "C:\Program Files\Google\google_appengine\lib\django\django\template_init_.py", line 168, in render return self.nodelist.render(context) File "C:\Program Files\Google\google_appengine\lib\django\django\template_init_.py", line 705, in render bits.append(self.render_node(node, context)) File "C:\Program Files\Google\google_appengine\lib\django\django\template_init_.py", line 718, in render_node return(node.render(context)) File "C:\Program Files\Google\google_appengine\lib\django\django\template\defaulttags.py", line 209, in render return self.nodelist_true.render(context) File "C:\Program Files\Google\google_appengine\lib\django\django\template_init_.py", line 705, in render bits.append(self.render_node(node, context)) File "C:\Program Files\Google\google_appengine\lib\django\django\template_init_.py", line 718, in render_node return(node.render(context)) File "C:\Program Files\Google\google_appengine\lib\django\django\template_init_.py", line 768, in render return self.encode_output(output) File "C:\Program Files\Google\google_appengine\lib\django\django\template_init_.py", line 757, in encode_output return str(output) File "C:\Program Files\Google\google_appengine\lib\django\django\newforms\util.py", line 26, in str return self.unicode().encode(settings.DEFAULT_CHARSET) File "C:\Program Files\Google\google_appengine\lib\django\django\newforms\forms.py", line 73, in unicode return self.as_table() File "C:\Program Files\Google\google_appengine\lib\django\django\newforms\forms.py", line 144, in as_table return self._html_output(u'%(label)s%(errors)s%(field)s%(help_text)s', u'%s', '', u'%s', False) File "C:\Program Files\Google\google_appengine\lib\django\django\newforms\forms.py", line 129, in _html_output output.append(normal_row % {'errors': bf_errors, 'label': label, 'field': unicode(bf), 'help_text': help_text}) File "C:\Program Files\Google\google_appengine\lib\django\django\newforms\forms.py", line 232, in unicode value = value.str() File "C:\Program Files\Google\google_appengine\lib\django\django\newforms\util.py", line 26, in str return self.unicode().encode(settings.DEFAULT_CHARSET) File "C:\Program Files\Google\google_appengine\lib\django\django\newforms\widgets.py", line 246, in unicode return u'\n%s\n' % u'\n'.join([u'%s' % w for w in self]) File "C:\Program Files\Google\google_appengine\lib\django\django\newforms\widgets.py", line 238, in iter yield RadioInput(self.name, self.value, self.attrs.copy(), choice, i) File "C:\Program Files\Google\google_appengine\lib\django\django\newforms\widgets.py", line 212, in init self.choice_value = smart_unicode(choice[0]) TypeError: 'int' object is unsubscriptable Do You have any idea how I can do this validation in different case? I have tried to do it using this kind of: class ItemUserAnswer(djangoforms.ModelForm): class Meta: model = UserAnswer But I dont know how to add extra labels to this form and it is displayed in one line. Do You have any suggestions? Thanks a lot as it making me crazy why it is still not working:/

    Read the article

  • Protect all XML-RPC calls with HTTP basic auth but one

    - by bodom_lx
    I set up a Django project for smartphone serving XML-RPC methods over HTTPS and using basic auth. All XML-RPC methods require username and password. I would like to implement a XML-RPC method to provide registration to the system. Obviously, this method should not require username and password. The following is the Apache conf section responsible for basic auth: <Location /RPC2> AuthType Basic AuthName "Login Required" Require valid-user AuthBasicProvider wsgi WSGIAuthUserScript /path/to/auth.wsgi </Location> This is my auth.wsgi: import os import sys sys.stdout = sys.stderr sys.path.append('/path/to/project') os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings' from django.contrib.auth.models import User from django import db def check_password(environ, user, password): """ Authenticates apache/mod_wsgi against Django's auth database. """ db.reset_queries() kwargs = {'username': user, 'is_active': True} try: # checks that the username is valid try: user = User.objects.get(**kwargs) except User.DoesNotExist: return None # verifies that the password is valid for the user if user.check_password(password): return True else: return False finally: db.connection.close() There are two dirty ways to achieve my aim with current situation: Have a dummy username/password to be used when trying to register to the system Have a separate Django/XML-RPC application on another URL (ie: /register) that is not protected by basic auth Both of them are very ugly, as I would also like to define a standard protocol to be used for services like mine (it's an open Dynamic Ridesharing Architecture) Is there a way to unprotect a single XML-RPC call (ie. a defined POST request) even if all XML-RPC calls over /RPC2 are protected?

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >