Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 348115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:20:04+00:00 2026-05-12T11:20:04+00:00

Getting a rendering error for this form: ‘NoneType’ object has no attribute ‘widget’ http://dpaste.com/88585/

  • 0

Getting a rendering error for this form:

‘NoneType’ object has no attribute ‘widget’
http://dpaste.com/88585/

Any ideas?

view

def your_photos_upload(request):
    if request.method == 'POST':
        form = MemorialUserPhotosForm(request.FILES)
        if form.is_valid():

form

class MemorialUserPhotosForm(ModelForm):
    image = forms.ImageField(label="Select an image to upload.",  error_messages={'missing' : 'No image selected',  'invalid' : 'Please select an image',  'invalid_image' : 'Not a valid image file'})

    class Meta:
        model=MemorialUserPhotos

        fields=('image')

html

<form enctype="multipart/form-data" method="post" action="{{ processor }}">
<li><label for="id_image">Select an image to upload.</label> <input type="file" id="id_image" name="image"/></li>
<input type="hidden" name="sessionid" value="7e4b4626c6ae1021ba0bae7969bfdd14">
<input type="submit">
</form>

models

class MemorialUserPhotos(Photo):
    user = models.ForeignKey(User)
    modified = models.DateTimeField(auto_now=True)
    class Meta:
        db_table = u'memorial_user_photos'
        verbose_name = 'User Uploaded Photo'
        verbose_name_plural = 'User Uploaded Photo'
        ordering = ['user']
        get_latest_by = 'modified'

    def save(self):
        self.is_public = False
        if self.title is None:
            self.image.name
        if self.title_slug is None:
            self.title_slug = slugify(self.title)
        super(MemorialUserPhotos, self).save()
        gallery = Gallery.objects.get(id=settings.USER_GALLERY)
        gallery.photos.add(self)


class Photo(ImageModel):
    title = models.CharField(_('title'), max_length=100, unique=True)
    title_slug = models.SlugField(_('slug'), unique=True,
                                  help_text=('A "slug" is a unique URL-friendly title for an object.'))
    caption = models.TextField(_('caption'), blank=True)
    date_added = models.DateTimeField(_('date added'), default=datetime.now, editable=False)
    is_public = models.BooleanField(_('is public'), default=True, help_text=_('Public photographs will be displayed in the default views.'))
    tags = TagField(help_text=tagfield_help_text, verbose_name=_('tags'))



class ImageModel(models.Model):
    image = models.ImageField(_('image'), max_length=IMAGE_FIELD_MAX_LENGTH, 
                              upload_to=get_storage_path)
    date_taken = models.DateTimeField(_('date taken'), null=True, blank=True, editable=False)
    view_count = models.PositiveIntegerField(default=0, editable=False)
    crop_from = models.CharField(_('crop from'), blank=True, max_length=10, default='center', choices=CROP_ANCHOR_CHOICES)
    effect = models.ForeignKey('PhotoEffect', null=True, blank=True, related_name="%(class)s_related", verbose_name=_('effect'))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:20:05+00:00Added an answer on May 12, 2026 at 11:20 am

    Nope, it’s a classic python gotcha :

    fields=('image')
    

    ‘image’ is not a tuple, it’s just a parenthesized string. Guess what happens, the framework tries to iterate through your string instead of iterating through the tuple ( ‘i’, ‘m’, ‘a’, ‘g’, ‘e’ ).

    a valid tuple with only one element is written with an additional comma:

     fields=('image',)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 228k
  • Answers 228k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I used the JsUnitMockTimeout.js to simulate the setInterval function. It… May 13, 2026 at 1:37 am
  • Editorial Team
    Editorial Team added an answer It's not clear what you mean by the term "overhead,"… May 13, 2026 at 1:37 am
  • Editorial Team
    Editorial Team added an answer As Pekka suggested, I now check for null and call… May 13, 2026 at 1:37 am

Related Questions

Getting a rendering error for this form: 'NoneType' object has no attribute 'widget' http://dpaste.com/88585/
I have a Ruby on Rails application I'm using Ruby 1.9 and Rails 2.3.4
I'm developing an AJAX site. So the problem is browsers (Safari, Chrome) do not
[update2] One of those problems I solved & can't remember how... :) [update1] could
I tried to precompile my ASP.NET MVC application and deploy it to an IIS6

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.