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 368393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:49:10+00:00 2026-05-12T13:49:10+00:00

I am trying to set up links to a view that allows to edit

  • 0

I am trying to set up links to a view that allows to edit objects, in previous view.
Model:

class List(models.Model):
 user = models.ForeignKey(User)
 name = models.CharField(max_length=200)
 type = models.PositiveIntegerField(choices=TYPE_DICT)

 def __unicode__(self):
  return self.name

 @models.permalink
 def get_absolute_url(self):
  return ('EditList', None, {'list_id':self.id} )

View:

  lists = List.objects.filter(user=request.user)
  array = []
  for list in lists:
   ListDict = {'Name':list.name, 'type':types[str(list.type)], 'edit':list }
   array.append(ListDict)
  context = { 'array':array,} 

Template:

    {% for dict in array %}
        <tr>
        {% for key,value in dict.items %}
            {% ifequal key 'edit' %}
                <td>{{ key }}</td><td><a href="{{ value.get_absolute_url }}">{{ value.name }}</a></td>
            {% else %}
                <td>{{ key }}:&nbsp;</td><td>{{ value }}</td>
            {% endifequal %}
        {% endfor %}
        </tr>
    {% endfor %}

and urls conf:

urlpatterns = patterns('tst.list.views',
 (r'^$', 'list'),
 (r'^edit/(?P<list_id>\d+)/$', 'EditList')

,

What this line with link gives me is http://localhost/list/ as url, not http://localhost/list/edit/%5Bobjectid%5D/

Can anyone please tell me what am i doing wrong?

Alan

  • 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-12T13:49:10+00:00Added an answer on May 12, 2026 at 1:49 pm

    If you had wanted to do it for an unnamed urlconf, you just needed to pass the whole import string:

    @models.permalink
    def get_absolute_url(self):
        return ('yourproject.yourapp.views.EditList', None, {'list_id':self.id} )
    

    I also suggest you follow the PEP8 naming conventions for functions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to set a Table View Cell that has been grouped, as a
Im trying set the single table inheritance model type in a form. So i
I'm trying to add simple links in kohana inside a view inside a loop
I'm trying to add a link to a Rails view to set a boolean
I'm trying to look for all addresses in a table view, that belong to
I'm trying to execute a query with SQL*Plus (command line) that is a VIEW.
I'm trying to send post using API feed. I set fields: message , link
I am trying set up databinding as described in the title. The problem I
Trying to set RowHeight like this(in code): dgvTruckAvail.RowTemplate.Height = 48; Doesnt' work. I also
Trying to set up caching on our datasets - we're using clr stored procedures

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.