yes, of course.
---------------------
from django.views.generic.create_update import create_object,
update_object
from django.views.generic.simple import redirect_to
from voting.views import vote_on_object
from project.komentar.models import *
komentar_vote_dict = {
'model': Komentar,
'template_object_name': 'komentar',
}
komentar_date_dict = {
'queryset': Komentar.objects.all().select_related(),
'date_field': 'created',
'template_object_name': 'komentar',
}
komentar_latest_dict = {
'queryset': Komentar.objects.order_by('-
created').select_related(),
'template_object_name': 'komentar',
'extra_context' : { 'sort' : 'latest' },
'allow_empty': 'true',
'paginate_by': 25,
'template_name' : 'komentar/komentar_list.html',
}
urlpatterns = patterns('',
(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?
P<slug>[-\w]+)/$', object_detail, dict(komentar_date_dict,
slug_field='slug')),
(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/
$', archive_day, dict(komentar_date_dict,
allow_empty=True)),
(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/
$', archive_month,
dict(komentar_date_dict, allow_empty=True)),
(r'^(?P<object_id>\d+)/(?P<direction>up|down|clear)/?$',
vote_on_object, komentar_vote_dict),
(r'^edit/(?P<object_id>\d+)/$', update_object,
dict(model=Komentar, login_required=True, template_name="komentar/
komentar_edit_form.html")),
(r'^create/$', create_object,
dict(model=Komentar, login_required=True, post_save_redirect="/
komentar/latest/")),
(r'^latest/$', object_list,
dict(komentar_latest_dict)),
(r'^$', redirect_to, {'url': '/komentar/
latest/'}),
)
this is urls.py from project/app.
i'll paste urls.py from project too:
------------------------------------
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template,
redirect_to
from registration.views import register
from project.user_details.views import create_user_profile
urlpatterns = patterns('',
(r'^komentar/$', include('project.komentar.urls')),
(r'^users/',
include('project.user_details.urls')),
(r'^accounts/register/$', register, {'profile_callback':
create_user_profile}),
(r'^accounts/', include('registration.urls')),
(r'^accounts/profile/$', redirect_to, {'url': '/'}),
(r'^accounts/$', direct_to_template, {'template':
'registration/index.html'}),
(r'^$', direct_to_template, {'template':
'homepage.html'}),
(r'^admin/', include('django.contrib.admin.urls')),
(r'^r/',
include('django.conf.urls.shortcut')),
(r'',
include('django.contrib.flatpages.urls')),
)
I'm sorry for this long paste.. i could you dpaste.
thanks, martin