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
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
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.
>>>
>
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
>
> 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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'
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"
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
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
> > >
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
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
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.
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
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
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.
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,
> 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
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
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
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)
#
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
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
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
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 __
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
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
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
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
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
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
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
would this be preferable?
from admin.py
class HDChannelInline(admin.TabularInline):
model = HDChannel
extra = 0
template = 'admin/edit_inline/tabular.html'
def get_form
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
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
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
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
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
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.
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
>> 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
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
>
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
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
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
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
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
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
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
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')
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
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
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:
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
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
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
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
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(
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 ...
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
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
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.
>
>
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
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
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
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)
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
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
[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
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
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
84 matches
Mail list logo