RE: Pass empty slug field in urls

2018-07-12 Thread Matthew Pava
Subject: Pass empty slug field in urls Hello. I am trying to make this system work: Restaurant/views.py: class SearchRestaurantListView(ListView): # template_name = 'restaurants/restaurantlocation_list.html' def get_queryset(self): print(self.kwargs) slug = self.

Pass empty slug field in urls

2018-07-12 Thread Can Hicabi Tartanoglu
urls.py: path('restaurants//', SearchRestaurantListView.as_view()) When the slug field is empty the debugger states it couldn't find 'restaurants/', the statement above should work no? Appearently not. Please help -- You received this message because you are subscribed to the G

Make the prepopulated slug field as readonly in Django Admin

2013-01-28 Thread Meenakshi
I want to make the slug field as read_only depending on the other field value like "lock_slug". Means There will be Two conditions. 1) When value of "lock_slug" is false then the slug field directly prepopulated from the field "title". prepopulated_fields =

Re: render a models slug field as a url

2012-07-26 Thread Matthew Meyer
That was it, it is working now. Thank you so much Daniel! :) On Thursday, July 26, 2012 4:25:10 AM UTC-4, Daniel Roseman wrote: > > On Thursday, 26 July 2012 03:45:41 UTC+1, Matthew Meyer wrote: >> >> HI daniel, thanks for the reply >> >> After your comments, I have used ModelForm to simplify my c

Re: render a models slug field as a url

2012-07-26 Thread Daniel Roseman
On Thursday, 26 July 2012 03:45:41 UTC+1, Matthew Meyer wrote: > > HI daniel, thanks for the reply > > After your comments, I have used ModelForm to simplify my code. I have > also achieved redirecting the desired url by using the redirect() function. > My issues are still basically the same howe

Re: render a models slug field as a url

2012-07-25 Thread Matthew Meyer
HI daniel, thanks for the reply After your comments, I have used ModelForm to simplify my code. I have also achieved redirecting the desired url by using the redirect() function. My issues are still basically the same however: - I do not know how to tell Django to render a template at the redir

Re: render a models slug field as a url

2012-07-25 Thread Daniel Roseman
On Wednesday, 25 July 2012 02:42:45 UTC+1, Matthew Meyer wrote: > > Hello all, > > I'm trying to load the url of a model created with get_absolute_url() > programmatically in my view. There are basically three steps I need to > accomplish this: > > 1. make sure @permalink is working correctly.

render a models slug field as a url

2012-07-24 Thread Matthew Meyer
Hello all, I'm trying to load the url of a model created with get_absolute_url() programmatically in my view. There are basically three steps I need to accomplish this: 1. make sure @permalink is working correctly. This step I am fairly confident I have completed. Here is the model I use: htt

edit unique slug field

2009-10-12 Thread Ali Rıza Keleş
I have a slug field(let's call A) which is prepopulated from another charfield(let's call B) and unique. On the admin page, when I want to edit B, at the same time A, A would not be changed. I try manually, it doesn't let me to edit it. How can I edit unique, prepopulated slug

Re: Slugify doesn't match pre-populated slug field.

2009-09-23 Thread Amos
On Wednesday 23 September 2009 17:06:44 Justin Myers wrote: > Two ideas: > 1. Instead of having the slug prepopulated, override save() [1] and > run slugify yourself. > 2. Instead of running slugify on the name, why not just access its > slugfield directly? > > HTH, > Justin > > [1] > http://doc

Re: Slugify doesn't match pre-populated slug field.

2009-09-23 Thread Justin Myers
Two ideas: 1. Instead of having the slug prepopulated, override save() [1] and run slugify yourself. 2. Instead of running slugify on the name, why not just access its slugfield directly? HTH, Justin [1] http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-predefined-model-methods

Slugify doesn't match pre-populated slug field.

2009-09-22 Thread Amos
I have an Admin form with a slugfield prepopulated from the name of the news item I'm creating. In one of my templates I have a link created using the slugify filter applied to the name of the news item. When I create an object with a name such as "A New Story" the prepoulated field contains "

Re: Slug Field

2009-07-14 Thread Alex Gaynor
;: ("title",)} > > admin.site.register(Story, StoryAdmin) > > Now, should I expect the slug field to get automatically populated > with the value of title, each time an entry is saved. What is the > expected behaviour of slug? Currently, I cannot see the value of title

Slug Field

2009-07-14 Thread Sonal Breed
rField(max_length=50, blank=False) story = models.CharField(max_length=500, blank=False) In admin.py class StoryAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ("title",)} admin.site.register(Story, StoryAdmin) Now, should I expect the slug field to get automatically

Re: slug field not populated on form save

2009-05-01 Thread Gabriel
Malcolm Tredinnick escribió: > The Model class calls pre_save() to work out the value to save into the > database. That's working correctly for you, as you've noticed: the right > value is being saved. > > Some Field subclasses in Django also use pre_save() as a way to > normalise the value in th

Re: slug field not populated on form save

2009-04-30 Thread Malcolm Tredinnick
On Thu, 2009-04-30 at 23:46 -0300, Gabriel wrote: > I have a model with a custom field: [...] > class AutoSlugField(fields.SlugField): > def __init__(self, prepopulate_from, force_update = False, *args, > **kwargs): > self.prepopulate_from = prepopulate_from > self.force_updat

slug field not populated on form save

2009-04-30 Thread Gabriel
I have a model with a custom field: class Project(models.Model): slug = fields.AutoSlugField(max_length=50, unique=True, editable=False, prepopulate_from="name", force_update=False) name = models.CharField(unique=True, verbose_name=_('Name'), max_length=50, help_text=_('The project name t

Newforms-admin - Problem prepopulating an inline slug field

2008-04-21 Thread tenni
I'm trying to prepopulate a slug field with newforms-admin. It works fine for the 'normal' Article model, but the inline Photo model's slug field won't prepopulate from it's title field. (If the code below doesn't make sense, I can paste the whole model.) T

[Newforms-admin] Prepopulating a slug field in an inline

2008-04-21 Thread tenni
I'm trying to prepopulate a slug field with newforms-admin. It works fine for the 'normal' Article model, but the inline Photo model's slug field won't prepopulate from it's title field. (If the code below doesn't make sense, I can paste the whole model.) T

Re: Slug field prepopulated from more than one field?

2007-08-07 Thread Jarek Zgoda
OK, it works... if the fields are "local" to model (not Foreign-keyed nor M2M related). I'm gonna file documentation patch, as the docs currently say anything on DateTimeField only. On 5 Sie, 15:01, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Is it possible to get slug fiel

Slug field prepopulated from more than one field?

2007-08-05 Thread Jarek Zgoda
Is it possible to get slug field prepopulated from more than one field? The docs say that yes, but I seem to not be able to get any prepopulation if I have prepopulated_from=('field1', 'field2') in my model. Should I file a ticket? I use SVN trunk (rev 5804).

How to prepopulate a slug field with a foreign key?

2007-03-29 Thread Rick van Hattem
I have just written a model to extend the user model a bit and now I'd like to add a slug field for the username, however, I can't get the slug field to prepopulate from the user foreign key. A simplified version of the model would be this: from django.db import m

slug field and generic create view

2006-10-03 Thread Patrick J. Anderson
Is there a simple way to add the slug field to a custom form template? I'm using django.views.generic.create_update.create_object and my model has a slug field. Whenever I try to add a new item to database, I receive error saying that my "title" is similar to the on existing i

Re: making slug field unique

2006-01-18 Thread Bryan Murdock
On 1/17/06, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > > On Tuesday 17 Jan 2006 9:04 pm, Bryan Murdock wrote: > > OK, so as a database dummy, how exactly is this done? Do I pipe > > the output of 'manage.py sqlreset myapp' to psql, or is there a > > less drastic way since I know I've only chan

Re: making slug field unique

2006-01-17 Thread Kenneth Gonsalves
On Tuesday 17 Jan 2006 9:04 pm, Bryan Murdock wrote: > OK, so as a database dummy, how exactly is this done?  Do I pipe > the output of 'manage.py sqlreset myapp' to psql, or is there a > less drastic way since I know I've only changed this one thing? >  I don't have any real data in the database

Re: making slug field unique

2006-01-17 Thread Bryan Murdock
On 1/17/06, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > > On Tuesday 17 Jan 2006 4:45 pm, Julio Nobrega wrote: > > Restriction *is* on the database too, when you run "manage.py > > startsql" (the command that outputs the CREATE TABLEs) you can > > see the UNIQUE being added. But Bryan is updati

Re: making slug field unique

2006-01-17 Thread Kenneth Gonsalves
On Tuesday 17 Jan 2006 4:45 pm, Julio Nobrega wrote: >   Restriction *is* on the database too, when you run "manage.py > startsql" (the command that outputs the CREATE TABLEs) you can > see the UNIQUE being added. But Bryan is updating his model, > adding the UNIQUE after the table has been create

Re: making slug field unique

2006-01-17 Thread Julio Nobrega
Restriction *is* on the database too, when you run "manage.py startsql" (the command that outputs the CREATE TABLEs) you can see the UNIQUE being added. But Bryan is updating his model, adding the UNIQUE after the table has been created... On 1/17/06, Jordi Funollet <[EMAIL PROTECTED]> wrote: >

Re: making slug field unique

2006-01-17 Thread Kenneth Gonsalves
On Tuesday 17 Jan 2006 3:53 pm, Jordi Funollet wrote: > >  Afaik Django enforces uniqueness at the application level, but > > you could always add it to the database: > > Ouch. Really? So Django is assuming that we are going to work > with their database *exclusively* through Django, and doesn't >

Re: making slug field unique

2006-01-17 Thread James Bennett
On 1/17/06, Jordi Funollet <[EMAIL PROTECTED]> wrote: > This restriction should be on database, shouldn't it? I'd think this would run into compatibility problems with the various supported backends. For example, SQLite supports UNIQUE, but not FOREIGN KEY constraints (its official docs say that

Re: making slug field unique

2006-01-17 Thread Jordi Funollet
Julio Nobrega dixit: > Afaik Django enforces uniqueness at the application level, but you > could always add it to the database: Ouch. Really? So Django is assuming that we are going to work with their database *exclusively* through Django, and doesn't protect us from doing silly things to the d

Re: making slug field unique

2006-01-16 Thread Julio Nobrega
Afaik Django enforces uniqueness at the application level, but you could always add it to the database: ALTER TABLE table ADD UNIQUE (slug) I don't think it's a bad idea at all, it all depends ;) On 1/16/06, Bryan Murdock <[EMAIL PROTECTED]> wrote: > > I think I want my model's SlugField to

making slug field unique

2006-01-16 Thread Bryan Murdock
I think I want my model's SlugField to be unique (let me know if this is a Bad Idea for any reason). So I edit my model and change slug=meta.SlugField() to slug=meta.SlugField(unique=True). Do I need to do anything to update the database now? Thanks, Bryan