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

  • SEARCH
  • Home
  • 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 8855301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:06:16+00:00 2026-06-14T14:06:16+00:00

I’d like to get posted-data from a form and display them. I used {%

  • 0

I’d like to get posted-data from a form and display them.
I used “{% url uasite1.views.sell_detail sell_detail.pk %}” to extract data according to their pk.

However, just [ NoReverseMatch ・・・, Reverse for ‘uasite1.views.sell_detail’ with arguments ‘(”,)’ and keyword arguments ‘{}’ not found.] showed up.
What’s wrong with my codes?

models.py

from django.db import models
from django.forms import ModelForm

class Sell(models.Model):
    subject = models.CharField(max_length=100)
    price = models.CharField(max_length=100)
    condition = models.CharField(max_length=100)
    email = models.EmailField()
    body = models.CharField(max_length=200)

forms.py

from django.forms import ModelForm
from uasite1.models import Sell

class SellForm(ModelForm):
    class Meta:
        model = Sell

views.py

from django.shortcuts import render_to_response,get_object_or_404
from django.http import HttpResponseRedirect
from uasite1.forms import SellForm
from uasite1.models import Sell
from django.template import RequestContext


def sell_detail(request, pk):
    sell = get_object_or_404(Sell, pk=int(pk))
    return render_to_response('sell_display.html',{'sell':sell})

def sell_create(request):
    context = {}
    if request.method == 'POST':
        form = SellForm(request.POST)
        if form.is_valid():
            new_sell = form.save()
            return HttpResponseRedirect('/sechand/%d/' % new_sell.pk)
    else:
        form = SellForm()
    context['form'] = form
    return render_to_response('sell.html',context,context_instance = RequestContext(request))

def Electronics(request):
    latest_sell_list = Sell.objects.all()[:5]
    return render_to_response('electronics.html',{'latest_sell_list':latest_sell_list})

urls.py

from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^sechand/$','uasite1.views.sell_create'),
    url(r'^sechand/(\d+)/$', 'uasite1.views.sell_detail'),
    url(r'^electronics/$', 'uasite1.views.Electronics'),
    url(r'^admin/', include(admin.site.urls)),
)

electronics.html

{% extends 'base.html' %}
{% block extrahead %}
    <p><strong>Electronics</strong></p>

{% endblock %}

{% block content %}

    <p><a href="{% url uasite1.views.sell_detail sell_detail.pk %}">{{ sell.subject }}</a></p>

{% endblock %}
  • 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-06-14T14:06:17+00:00Added an answer on June 14, 2026 at 2:06 pm

    There are couple of mistakes.

    1: Change your url

    url(r'^sechand/(\d+)/$', 'uasite1.views.sell_detail'),
    

    to

    url(r'^sechand/(P<pk>\d+)/$', 'uasite1.views.sell_detail'),
    

    This makes url to accept parameter which is passed to view through pk.

    2: Your Electronics() view suggests that you are passing list to template so you need to update template to iterate over this list and render each item in list appropriately. And make sure to use variable names appropriately.

    {% block content %}
    
        {%for sell in latest_sell_list %}
            <p><a href="{% url uasite1.views.sell_detail sell.pk %}">{{ sell.subject }}</a></p>
    
        {%endfor%}
    {% endblock %}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I used javascript for loading a picture on my website depending on which small
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace
I would like to run a str_replace or preg_replace which looks for certain words

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.