Re: override save() twice in django model!

2021-05-01 Thread RITIK SONI
yea! ig you are right! we cant override it twice. On Sat, May 1, 2021 at 7:25 PM Kunal Solanke wrote: > I don't think so, why not do in one function or you can use pre save and > pist save signals > > On Sat, May 1, 2021, 19:11 RITIK SONI wrote: > >> am i able to override save() method of a dja

Re: override save() twice in django model!

2021-05-01 Thread Kunal Solanke
I don't think so, why not do in one function or you can use pre save and pist save signals On Sat, May 1, 2021, 19:11 RITIK SONI wrote: > am i able to override save() method of a django model twice? > > -- > You received this message because you are subscribed to the Google Groups > "Django user

Re: Override value of a TextField class method.

2020-01-07 Thread Fabio da Silva Pedro
OK, thank's for this! Em ter., 7 de jan. de 2020 às 03:03, Mohamed A escreveu: > Hint:.. __init__ is a constructor not any method. > > Le lun. 6 jan. 2020 à 23:02, Fabio da Silva Pedro < > fabio.silvape...@gmail.com> a écrit : > >> Easy. You need to provide attrs as dict to the new object. >>> >

Re: Override value of a TextField class method.

2020-01-06 Thread Mohamed A
Hint:.. __init__ is a constructor not any method. Le lun. 6 jan. 2020 à 23:02, Fabio da Silva Pedro < fabio.silvape...@gmail.com> a écrit : > Easy. You need to provide attrs as dict to the new object. >> >> > Ok, I thought about that too, but I don't know how to do it, I copied the > whole method

Re: Override value of a TextField class method.

2020-01-06 Thread Fabio da Silva Pedro
> > Easy. You need to provide attrs as dict to the new object. > > Ok, I thought about that too, but I don't know how to do it, I copied the whole method and pasted it into my model and tried to access its superclass, but I didn't get it! Maybe I'm doing something wrong yet. Would you have any exa

Re: Override value of a TextField class method.

2020-01-06 Thread Mohamed A
Easy. You need to provide attrs as dict to the new object. Le lun. 6 jan. 2020 à 21:36, Fabio da Silva Pedro < fabio.silvape...@gmail.com> a écrit : > Hi everyone! > > this is an excerpt line from my model > > observacoes = models.TextField(null=True, blank=True, > verbose_name='Informações comp

Re: Override base filter for model's queryset (Django 1.6)?

2017-01-15 Thread Melvyn Sopacua
Hi Derek, On Sunday 15 January 2017 06:53:10 Derek wrote: > You don't appear to have understood my question; and I did not see > this particular use case covered in the docs (which is why I asked > it). You also pointed me to the wrong version; in particular > "QuerySet.as_manager()" is not metho

Re: Override base filter for model's queryset (Django 1.6)?

2017-01-15 Thread Derek
Hi Melvyn You don't appear to have understood my question; and I did not see this particular use case covered in the docs (which is why I asked it). You also pointed me to the wrong version; in particular "QuerySet.as_manager()" is not method in 1.6. On Saturday, 14 January 2017 21:58:15 UTC+2

Re: Override base filter for model's queryset (Django 1.6)?

2017-01-14 Thread Melvyn Sopacua
On Saturday 14 January 2017 21:20:32 Derek wrote: > and I also want to override the base filter for > the model's > queryset to limit what is displayed. This is covered in the Manager documentation[1] in detail. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/topics/db/ma

Re: Override

2014-11-02 Thread Collin Anderson
Hi Julien, It also might be possible to "monkeypatch" the function. It's generally not recommended, but it might be worth it in your case. Collin -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receivin

Re: Override

2014-10-30 Thread Avraham Serour
this is why VCS were created for. if the project is already under git, just clone and don't push On Thu, Oct 30, 2014 at 6:09 AM, Julien Romagnoli < julien.romagn...@gmail.com> wrote: > Hello Guys, > > I'm working on the an existing project with django, > but i need to change some behavior of thi

Re: Override runserver django 1.7

2014-10-06 Thread Collin Anderson
It's because the staticfiles app is already overriding the built in runserver command, and it's competing with your app. I think it's the only case of a contrib app overriding a built-in command. The migrate command is built-in to django and there are no contrib apps that override it. -- You

Re: Override runserver django 1.7

2014-10-06 Thread Carlos Perche
great, now it is working. but i have still a question, why the position in the installed_apps does not affect the migrate command and affect the runserver command ? thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from th

Re: Override runserver django 1.7

2014-10-06 Thread Collin Anderson
try putting the staticfiles app below saas in your INSTALLED_APPS -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To p

Re: Override grappelli js files

2014-02-25 Thread rush
Wow, that's a great explanation. Thank you, Felipa! wbr,rush.   26.02.2014, 00:52, "Felipe Bessa Coelho" :2014-02-25 17:18 GMT-03:00 rush :Hi,I'm using grappelli and I have two files in it I need to modify:admin/js/SelectBox.js admin/js/SelectFilter2.jsI thought it would be a good

Re: Override grappelli js files

2014-02-25 Thread Felipe Bessa Coelho
2014-02-25 17:18 GMT-03:00 rush : > Hi, > > I'm using grappelli and I have two files in it I need to modify: > > admin/js/SelectBox.js > admin/js/SelectFilter2.js > > I thought it would be a good idea to put it into my app static directory: > > my_app/static/admin/js/SelectBox.js > my_app/static/a

Re: Override save or other options?

2012-09-12 Thread Cal Leeming [Simplicity Media Ltd]
Curious, we had to do a similar thing for billing periods on our VoIP system a while back. We ended up using dateutil, here's a bit of a code dump. This was all triggered from populate_billing_periods() which was called at the point of processing billing info (which happens every 24 hours) Would

Re: Override save or other options?

2012-09-11 Thread Lachlan Musicman
On Wed, Sep 12, 2012 at 11:46 AM, Mario Gudelj wrote: > I had to do the same thing recently. I had to grab the frequency, interval > etc. (used rrule for that) and then had to look at the first event instance > and create multiple instances from that event inside the view. If you create > a series

Re: Override save or other options?

2012-09-11 Thread Mario Gudelj
I had to do the same thing recently. I had to grab the frequency, interval etc. (used rrule for that) and then had to look at the first event instance and create multiple instances from that event inside the view. If you create a series model and use it as a foreign key in your event to keep on top

Re: Override save or other options?

2012-09-11 Thread Lachlan Musicman
On Tue, Sep 11, 2012 at 5:15 PM, Jani Tiainen wrote: > > Rather than creating individual series of events from recurring I would do a > concept called "recurring event". So it would be just a single event that is > projected to spesific days as necessary. It requires a slightly more work > but it'

Re: Override save or other options?

2012-09-10 Thread Jani Tiainen
11.9.2012 7:23, Lachlan Musicman kirjoitti: Hi All, Simplistically, I have an event type model (for a "school class") with a date field. On saving of the first event, I want to add recurring objects. Specifics for this project are "up to a latest date" (ie, end of term) and "recur weekly only"

Re: Override table name(s) in application deployment

2011-03-24 Thread Jacob Kaplan-Moss
On Thu, Mar 24, 2011 at 12:30 PM, Flo Ledermann wrote: > I was quite surprised that I couldn't find a way to override table > names for an application's models on a per-deployment basis (i.e. in > settings.py or some other project/site specific file instead of > modifying the models.py file of the

Re: Override default django Registration email

2011-03-04 Thread Tomasz Zieliński
On 3 Mar, 14:23, bruno desthuilliers wrote: > On 3 mar, 13:39, Kenneth Gonsalves wrote: > > > On Thu, 2011-03-03 at 00:36 -0800, pols wrote: > > > Anyone knows how to override djangos default registration email.I > > > need to alter it to sent as html email instead of text email.As i am a > > >

Re: Override default django Registration email

2011-03-03 Thread pols
hai i need to send my activation_email.html template instead of activattion_email.txt.By default django sends only text emails as the activation mail.But i need to send this as html.so i need to override that email sending function.but i dont know how? -- You received this message because you a

Re: Override default django Registration email

2011-03-03 Thread bruno desthuilliers
On 3 mar, 13:39, Kenneth Gonsalves wrote: > On Thu, 2011-03-03 at 00:36 -0800, pols wrote: > > Anyone knows how to override djangos default registration email.I > > need to alter it to sent as html email instead of text email.As i am a > > bigner of django help me with complete information > > cop

Re: Override default django Registration email

2011-03-03 Thread pols
On Mar 3, 1:36 pm, pols wrote: > hai >      Anyone knows how to override djangos default registration > email(activation email).I > need to alter it to sent as HTML email instead of TEXT email.ie i need to > send my activation_email.html template intead of default template > activation_emai.

Re: Override default django Registration email

2011-03-03 Thread Kenneth Gonsalves
On Thu, 2011-03-03 at 00:36 -0800, pols wrote: > Anyone knows how to override djangos default registration email.I > need to alter it to sent as html email instead of text email.As i am a > bigner of django help me with complete information > > copy the templates to a folder called registration

Re: Override Method on DB get / filter / all

2011-02-13 Thread Jani Tiainen
On Sunday 13 February 2011 18:18:39 BW wrote: > I know you can override the save() method in a model, but is it > possible to do it when you try to get a row or rows from a db? I have > data like this '\xFF\x00\x00\x00\xFE'... that I need to store in a > MySQL db. > > When I was trying to save i

Re: Override Method on DB get / filter / all

2011-02-13 Thread Shawn Milochik
You can make a custom manager. http://docs.djangoproject.com/en/dev/topics/db/managers/#custom-managers-and-model-inheritance You probably don't realize it from normal use, but the 'objects' property you're using on your models is an instance of models.Manager, not an internal part of the models.

Re: override save()

2011-01-17 Thread Vovk Donets
if self.posrx is not the model field then this is the cause. *Vovk Donets* python/django developer skype: suunbeeam icq: 232490857 mail:donets.vladi...@gmail.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: override save()

2011-01-17 Thread Santiago Caracol
> Since these attributes > are "ordinary" attributes, they aren't saved to the database, so they > aren't loaded from it neither. It seems that this was the problem. Thank you. Santiago -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: override save()

2011-01-17 Thread bruno desthuilliers
On 17 jan, 15:36, Santiago Caracol wrote: > Sorry the formatting of the code went wrong. Here it is again: > > # > > class ContentClassifier(models.Model): > >     # >     def save(self, *args, **kwargs): >         self.compile() >         s

Re: override save()

2011-01-17 Thread Daniel Roseman
On Monday, January 17, 2011 2:24:39 PM UTC, Santiago Caracol wrote: > > Hello, > > I have got a model called ContentClassifier which uses regular > expressions to classify the content of messages. It has a method > compile() that compiles an instance's regular expressions into > self.posrx. Whe

Re: override save()

2011-01-17 Thread Santiago Caracol
Sorry the formatting of the code went wrong. Here it is again: # class ContentClassifier(models.Model): # def save(self, *args, **kwargs): self.compile() super(ContentClassifier, self).save(*args, **kwargs) #

Re: Override DECIMAL_SEPARATOR in certain cases?

2010-10-27 Thread Joachim Pileborg
Seems weird that no one have had this problem before... Maybe no one is using any other locale than en-us? Anyway, I solved it by making a custom template filter called "dotify", which if it gets a floating point number, converts it to a string, and replaces all commas with "dots": def dotify(val

Re: Override QuerySet.none()

2010-07-27 Thread bruno desthuilliers
On 27 juil, 10:37, gs794 wrote: > Thanks for the reply. > > I previously had a look at how QuerySet.none (in > Django.db.models.query) was implemented, and that didn 't give me any > clues - hence the post.  So I worked it out by looking at > http://seanmonstar.com/post/708862164/extending-django

Re: Override QuerySet.none()

2010-07-27 Thread gs794
Thanks for the reply. I previously had a look at how QuerySet.none (in Django.db.models.query) was implemented, and that didn 't give me any clues - hence the post. So I worked it out by looking at http://seanmonstar.com/post/708862164/extending-django-models-managers-and-querysets which explains

Re: Override QuerySet.none()

2010-07-27 Thread bruno desthuilliers
On 27 juil, 06:27, gs794 wrote: > Hi all, > > I'm having trouble overriding QuerySet.none() (code below)...  Works > if I rename the method to almost anything but "none". > > class QuerySetManager(models.Manager): >   def get_query_set(self): >     return self.model.QuerySet(self.model) >   def __

Re: Override Django ORM with virtual model class - is it possible or no?

2010-07-06 Thread test157
ok, I'll try to explain once again. I have real model class GenericModel(models.Model): val1 = models.CharField(max_length=50) val2 = models.CharField(max_length=80) it has its table in database like generic_model with fields like id | val1 | val2 the idea is just to create one this tabl

Re: Override Django ORM with virtual model class - is it possible or no?

2010-07-06 Thread thusjanthan
Hi, I am not sure if what your asking is possible as a field type in a database is generally a single field. What you are trying to do is have an object as a field type. Perhaps you can do a ForeignKey and have a m2m relationship between the GenericModel? From what I remember you can have custom f

Re: override base translations in your project

2010-05-17 Thread lenz
Thanks for your reply. I used makemessages and compilemessages. The path in the project is correct - the fault was just in my question. On 17 Mai, 16:25, Ramiro Morales wrote: > On Sun, May 16, 2010 at 7:46 PM, lenz wrote: > > The Django docs tell that it is possible to "overridebase > >transla

Re: override base translations in your project

2010-05-17 Thread lenz
Thanks for your reply. I used makemessages and compilemessages. The path in the project is correct - the fault was just in my question. On 17 Mai, 16:25, Ramiro Morales wrote: > On Sun, May 16, 2010 at 7:46 PM, lenz wrote: > > The Django docs tell that it is possible to "overridebase > >transla

Re: override base translations in your project

2010-05-17 Thread lenz
Thanks for your reply. I checked it ...they work. On 17 Mai, 15:43, Nuno Maltez wrote: > I believe it should work the way you describe (you can even remove the > line with the reference to the source). > > Are all the othertranslationsin your project, excepto for those > copied from the third pa

Re: override base translations in your project

2010-05-17 Thread Ramiro Morales
On Sun, May 16, 2010 at 7:46 PM, lenz wrote: > The Django docs tell that it is possible to "override base > translations in your project path" but i have no idea how this works. > > I tried to copy the some contents of an third party apps django.po to > the django.po file of the project but i see

Re: override base translations in your project

2010-05-17 Thread Nuno Maltez
I believe it should work the way you describe (you can even remove the line with the reference to the source). Are all the other translations in your project, excepto for those copied from the third party app, working fine? Nuno On Sun, May 16, 2010 at 11:46 PM, lenz wrote: > The Django docs te

Re: override TabularInline get_formset - need to call super method?

2010-05-07 Thread ryan
would this be preferable? from admin.py class HDChannelInline(admin.TabularInline): model = HDChannel extra = 0 template = 'admin/edit_inline/tabular.html' def get_form

Re: override a form field, to allow usernames with '@'

2010-05-04 Thread Nick Serra
I just implemented this and it's a hassle. There are heated discussions about it. I ended up modifying the auth app and completely eliminating the 'username' field and just using email. Then I modified the admin app to allow the login, and am basically just completely overriding both. Good luck! O

Re: override a form field, to allow usernames with '@'

2010-05-04 Thread Bill Freeman
Consider that there may be some third party app which you will want to add in the future, and that it may depend on the existing nature of usernames. (E.g.; uses username as a slug and uses a simple regular expression in a url pattern to capture the username. Consider that usernames are currently

Re: override a form field, to allow usernames with '@'

2010-05-03 Thread Felippe Bueno
Btw, I read about django don't accept @ in usernames, but I can create a User using User.create_user(m...@email.com, m...@email.com, mypassword) The only problem is, I can't save the user at admin site. I was thinking if the limitation is only at forms. I did not test the authentication yet. Any o

Re: Override Delete Function

2010-04-13 Thread cootetom
I've settled on a solution for this now which works fine. So I'm overriding the delete function for my model. In that function I'm clearing any references that I need to but I'm then also calling delete manually on any child objects that I also have overridden delete functions for. This does requir

Re: Override Delete Function

2010-04-13 Thread cootetom
OK I've tried the pre_delete approach but unfortunately it doesn't work for what I'm trying here. It appears that django gets a collection of objects that it is going to delete then it calls pre_delete on each object before finally deleting the objects. So django has decided which objects to delete

Re: Override Delete Function

2010-04-13 Thread cootetom
Thanks Ian, I'll give that a go later. I don't suppose it matters what order they are called in because it's only clearing references to do with the model instance it's calling from. On Apr 13, 2:15 am, Ian Lewis wrote: > Tom, > > You could try doing this clear logic in a pre_delete signal.

Re: Override Delete Function

2010-04-12 Thread Ian Lewis
Tom, You could try doing this clear logic in a pre_delete signal. You might have to test out the timing of when the signals get called but it should call pre_delete for all deleted models. In this case it would call pre_delete on model2 before model1 but you should be able to get what you are look

Re: override change_form.html & submit_line.html

2010-03-20 Thread Ogi Vranesic
>> Hi >> > >In order to adapt them I would like to override following templates: >> >> contrib/admin/templates/admin/change_form.html >> contrib/admin/templates/admin/submit_line.html >> and probably also >> contrib/admin/templates/admin/edit_inline/tabular.html >> > >In my project I have already a

Re: override change_form.html & submit_line.html

2010-03-20 Thread Daniel Roseman
On Mar 20, 12:07 pm, Ogi Vranesic wrote: > Hi > > In order to adapt them I would like to override following templates: > > contrib/admin/templates/admin/change_form.html > contrib/admin/templates/admin/submit_line.html > and probably also > contrib/admin/templates/admin/edit_inline/tabular.html >

Re: override django's rear-end validation for dynamic model field (AJAX)

2009-12-24 Thread Maksymus007
On Thu, Dec 24, 2009 at 5:24 PM, hotani wrote: > I have close to 600 users split by 20 or so offices. We have a > helpdesk form (using ModelForm) which displays an initial user list > based on the office, or no users if an office is not selected. > > An AJAX function on the front end dynamically c

Re: override django's rear-end validation for dynamic model field (AJAX)

2009-12-24 Thread Daniel Roseman
On Dec 24, 4:24 pm, hotani wrote: > I have close to 600 users split by 20 or so offices. We have a > helpdesk form (using ModelForm) which displays an initial user list > based on the office, or no users if an office is not selected. > > An AJAX function on the front end dynamically changes users

Re: Override __init__()

2009-08-17 Thread Emily Rodgers
On Aug 14, 4:26 pm, Daniel Roseman wrote: > On Aug 14, 3:50 pm, Léon Dignòn wrote: > > > Hi Emily, > > > thanks so far! > > > unfortunately this line: > > > > instance = getattr(kwargs, 'instance') > > throws this error: > > > Exception Value: 'dict' object has no attribute 'instance' > > > wh

Re: Override __init__()

2009-08-15 Thread Léon Dignòn
Now it's working!!! class ProfileForm(ModelForm): first_name = forms.CharField(required=False, max_length=30) last_name = forms.CharField(required=False, max_length=30) class Meta: model = UserProfile exclude = ('user',) # User will be filled in by the view. def

Re: Override __init__()

2009-08-15 Thread Léon Dignòn
I just tried that, but how can I access first_name in instance? instance.user.first_name ist not working. What I like to achieve is that instance.user.first_name is displayed in the textfield called also first_name, which is an additional field in my ModelForm. :/ Saving the additional field was

Re: Override __init__()

2009-08-14 Thread Daniel Roseman
On Aug 14, 6:44 pm, Léon Dignòn wrote: > Yeah! this is working very well! > > Now my last question. How can I change the initial-value of first_name > and last_name I defined in my class (look at first post)? I have  to > do it in the __init__() because I need some values of instance. > > Thanks

Re: Override __init__()

2009-08-14 Thread Léon Dignòn
Yeah! this is working very well! Now my last question. How can I change the initial-value of first_name and last_name I defined in my class (look at first post)? I have to do it in the __init__() because I need some values of instance. Thanks On Aug 14, 5:26 pm, Daniel Roseman wrote: > On Aug

Re: Override __init__()

2009-08-14 Thread Daniel Roseman
On Aug 14, 3:50 pm, Léon Dignòn wrote: > Hi Emily, > > thanks so far! > > unfortunately this line: > > > instance = getattr(kwargs, 'instance') > throws this error: > > Exception Value: 'dict' object has no attribute 'instance' > > what next? > That should be: instance = kwargs.get('instance')

Re: Override __init__()

2009-08-14 Thread Léon Dignòn
Hi Emily, thanks so far! unfortunately this line: > instance = getattr(kwargs, 'instance') throws this error: > Exception Value: 'dict' object has no attribute 'instance' what next? On Aug 14, 1:52 pm, Emily Rodgers wrote: > On Aug 14, 12:14 pm, Léon Dignòn wrote: > > > > > > > Hi, > > > I t

Re: Override __init__()

2009-08-14 Thread Emily Rodgers
On Aug 14, 12:14 pm, Léon Dignòn wrote: > Hi, > > I try override a ModelForms init to claim the variable instance. After > that I call super.__init__(). > It's almost working, but there is no form shown in the browser.  Any > ideas what might be wrong? > > class ProfileForm(ModelForm): >     fi

Re: override _display_login_form

2009-08-13 Thread Davo
After some digging it seems that in new django (SVN) the function is located somewhere else. This worked for me. - from django.contrib.admin import sites def _redirect_login(request, *args, **kwargs): return HttpResponseRedirect('http:

Re: override save()

2009-08-09 Thread Léon Dignòn
That kind of surprises me. I thought that the whole code will be parsed before actually doing something. Like C# :) But save() is not overridden! If I comment out super() it still saves the form. - class ProfileFormExtended(UserProfile): def save(self, force_insert=False, force_update=Fal

Re: override save()

2009-08-09 Thread Malcolm Tredinnick
On Sun, 2009-08-09 at 13:35 -0700, Léon Dignòn wrote: > Hi, > > I have a ModelForm of my UserProfile model with two additional fields. > I need to override save(), to save the additional fields to the > django.contrib.auth.model.User model. > I tried to do that with a subclass of my UserProfile m

Re: override render_to_response

2009-03-17 Thread matehat
I think the closest you could get to a painless implementation of what you need, for existing apps, could be to create a method named something like "render_to_json_response", that behave the way you want and have the appropriate "views" modules in each app import it as "render_to_response" (indee

Re: override render_to_response

2009-03-16 Thread Malcolm Tredinnick
On Mon, 2009-03-16 at 18:34 -0700, Preston Timmons wrote: > I am wondering if render_to_response is really the proper function you > are looking for. > > For instance, here is a simple view that returns json using > HttpResponse without need of a template: He was wanting to hijack the output fro

Re: override render_to_response

2009-03-16 Thread Preston Timmons
I am wondering if render_to_response is really the proper function you are looking for. For instance, here is a simple view that returns json using HttpResponse without need of a template: import simplejson from django.http import HttpResponse def output_json(request): data = [ dict(

Re: override render_to_response

2009-03-16 Thread Malcolm Tredinnick
On Mon, 2009-03-16 at 20:05 -0400, Malinka Rellikwodahs wrote: [...] > Unless I'm mistaken it should be fairly simple in this case to create > your own set of templates for each of the django apps you're using and > then have them output the data you need as json text instead of as > html Ooh ...

Re: override render_to_response

2009-03-16 Thread Malinka Rellikwodahs
On Mon, Mar 16, 2009 at 12:42, a b wrote: > Hi, > > I'm building a one page app with no page refresh. > All the content is loaded as JSON dynamically and the UI is built using > javascript. > > I'm using external django apps and I need them to send back the context dict > as JSON instead > of ren

Re: override render_to_response

2009-03-16 Thread Malcolm Tredinnick
On Mon, 2009-03-16 at 18:42 +0200, a b wrote: > Hi, > > I'm building a one page app with no page refresh. > All the content is loaded as JSON dynamically and the UI is built > using javascript. > > I'm using external django apps and I need them to send back the > context dict as JSON instead > o

Re: override model.save - prevent saving (admin)

2008-08-22 Thread David Zhou
On Aug 22, 2008, at 2:10 AM, jboutros wrote: > I have a model where I've overridden the save method. In a specific > case (validation fails against an external web service), I would like > to prevent the save from happening. I have implemented this by not > calling super.save in this case. > >

Re: Override admin filters

2008-02-05 Thread Jarek Zgoda
Aaron Fay napisał(a): > I'm wondering if there is a way to override the filters and and > list_display on the built-in users view/model in the django admin. I > would like to be able to filter/sort by group if possible. I asked for that few weeks ago and the answer was "no". There is a ticket

Re: override get_next_by_FOO() / get_previous_by_FOO()

2007-06-30 Thread orestis
I have defined a dictionary of lookup arguments in my manages so I can reuse them everywhere I want the same behavior... On Jun 10, 3:12 am, Jonathan Stockdill <[EMAIL PROTECTED]> wrote: > I found myself in a similar position and used the following: > def get_next_pub(self): >return

Re: override get_next_by_FOO() / get_previous_by_FOO()

2007-06-14 Thread Malcolm Tredinnick
On Sat, 2007-06-09 at 20:12 -0400, Jonathan Stockdill wrote: > I found myself in a similar position and used the following: > def get_next_pub(self): >return self.get_next_by_pub_date(pub_date__lt=datetime.now > (),is_draft=False) > def get_previous_pub(self): >return se

Re: override get_next_by_FOO() / get_previous_by_FOO()

2007-06-09 Thread Jonathan Stockdill
I found myself in a similar position and used the following: def get_next_pub(self): return self.get_next_by_pub_date(pub_date__lt=datetime.now (),is_draft=False) def get_previous_pub(self): return self.get_previous_by_pub_date(pub_date__lt=datetime.now (),is_draft=False)

Re: override get_next_by_FOO() / get_previous_by_FOO()

2007-05-08 Thread Malcolm Tredinnick
On Mon, 2007-05-07 at 22:32 +, roderikk wrote: > Hi all, > > I have recently started with django and have been able to do good work > with the excellent documentation. Thank you. > > However, now I am a little baffled. I have created a gallery app. The > model exists of a Gallery and Photo w

Re: override get_next_by_FOO() / get_previous_by_FOO()

2007-05-08 Thread roderikk
Well, sorry to be replying to myself but I have tried to solve it in the following way: I implemented these functions/properties in the model: def _get_next_item_ID(self): photo_list = [x for x in self.gallery.photo_set.all()] ind = photo_list.index(self)+1 return pho

Re: override save for imagefield not working

2006-09-10 Thread Sandro
[530] from IRC worked with me to figure out what's going on. Apparently save() is getting called twice, the first time saves the object, the second time applies the the uploaded directory. We need to check to see if self.image exists before trying to create thumbnails. Here's a simple version of

Re: Override value on save in admin

2006-08-17 Thread Bryan Chow
This was brought up a couple days ago: http://groups.google.com/group/django-users/browse_thread/thread/ca7091de1e961dff On 8/17/06, fyl <[EMAIL PROTECTED]> wrote: > Just entering data in the admin interface. I want to stuck the current > user in a field at save time if nothing has been specifie

Re: Override value on save in admin

2006-08-17 Thread Chris Long
Might be of help: http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googleg