Re: TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

2021-11-20 Thread Peter of the Norse
CommentForm inherits from both ModelForm and “forms”. I don’t know what “forms” is, but PEP-8 says all classes should be capitalized. If forms is a base class that has already defined Meta, then you need to have CommentForm’s extend it. So change the line to class Meta(forms.Meta): > On Oct

Re: Question regarding organizing models

2021-11-14 Thread Peter of the Norse
You can put a string with the name of a class that is yet to be defined in the ForeignKey. https://docs.djangoproject.com/en/3.2/ref/models/fields/#foreignkey In this case you would do created_by_id = models.ForeignKey(

Re: Idea

2021-10-31 Thread Peter of the Norse
Most of the people that think switching to node.js only know PHP. That’s why it looks like a good idea. > On Sep 20, 2021, at 2:46 AM, David Nugent wrote: > > This is almost the same case that nodejs users have put forward since it was > invented - why learn 2 languages when 1 will do? node

Re: Idea

2021-10-31 Thread Peter of the Norse
I’m worried that you are getting on the wrong track here. All web development is necessarily client-server based. One of the signs of a poorly designed VB application is the way that you can put DB code in a button action. That isn't possible in a browser. Instead all it can do is contact th

Re: Django 3.1 Makemigrations fails with FilePathField but succeeds with CharField

2021-06-22 Thread Peter of the Norse
I think you might be better off using https://docs.djangoproject.com/en/3.2/topics/migrations/#squashing-migrations than having it recreate all of them. > On Mar 18, 2021, at 8:28 AM, Olivier wrote: > > Hello, >

Re: Question about models. test

2021-05-02 Thread Peter of the Norse
This kind of script can be dangerous. It’s possible for malicious websites to create a page that can use up too many resources or otherwise act strangely. URLValidator

Re: QuerySet performance on large datasets

2021-04-11 Thread Peter of the Norse
taff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user"; args=() (0.000) SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user&q

Re: What values is expected for CSRF_COOKIE_PATH ?

2021-03-08 Thread Peter of the Norse
Some sites have Django installed in a sub-path of their site, e.g. http://mydomain.com/django/. In that case, you can set it to “/django-project/“ or “/“. Since the default is / you don’t need to do anything. If you have two separate Django installations on one site, then you need to change

Re: QuerySet performance on large datasets

2021-02-12 Thread Peter of the Norse
bool(qs) is recommended when the queryset has already been run. If you do something like val = qs.earliest(some_property) if bool(qs) else None then there isn’t a performance gain because it still has to run qs.exists() to even see if there is a value. Later things like that will be cach

Re: How to securely store passwords used in backend code

2021-01-10 Thread Peter of the Norse
I use multiple settings.py files to do this. Specifically, in my main one, I have what I consider the only acceptable instance of import *. import os if (os.getenv('PRODUCTION')): from .prod_settings import * else: from .dev_settings import * While dev_settings.py is in my repo, prod_se

Re: ForeignKey with different queryset from manager

2021-01-10 Thread Peter of the Norse
This is an interesting question. Thank you for asking it. I wasn’t able to find exactly what you are asking for. The closest I could find was https://docs.djangoproject.com/en/2.2/topics/db/queries/#using-a-custom-reverse-manager

Re: How to access using foreing key

2020-12-13 Thread Peter of the Norse
If you are looking for all of the Restaurants with a 5.0 rating, it looks like Restaurant.objects.filter(rating_restaurant__rating = 5.0) If you are looking for Restaurants with an average rating of 5.0, that’s a bit trickier. from django.db.models import Avg Restaurant.objects.annotate(avg_rat

Re: NoReverseMatch at /sitemap.xml

2020-03-04 Thread Peter of the Norse
You are using positional arguments when you should be using named args. Change the line to return reverse('blog-detail', kwargs = {‘slug’:item.slug, ‘year’:str(item.blog_published_at.year), ‘month’:str(item.blog_published_at.month), ‘day’:str(item.blog_published_at.day)}) > On Feb 22, 2020,

Re: Why use CustomUserManager.create_user and not CustomUserManager.create?

2019-03-14 Thread Peter of the Norse
The biggest difference is that when you call create_user, it creates a hash of the password. Eventually, create_user does call create, but only after setting all the values properly. Sent from my iPad > On Feb 17, 2019, at 4:30 AM, Maarten Nieber wrote: > > Hi, > > the Django guidelines tel

Re: How 2 access the Primary model's ID in the Foreign model??

2018-12-31 Thread Peter of the Norse
Also song.album_id will work as well, and faster too. Sent from my iPad > On Dec 4, 2018, at 3:43 PM, Mike Dewhirst wrote: > >> On 5/12/2018 7:07 AM, Sourajit Mohanty wrote: >> I have 2 model classes Album and Songs(where Song is the Foreign key) >> I want to access the Albums ID in the Songs c

Re: about unique_together

2018-12-13 Thread Peter of the Norse
Django doesn’t support multiple primary keys. unique_together just adds an extra constraint to the table. Since you didn’t specify a primary key, id was added for you by default. Sent from my iPad > On Nov 14, 2018, at 1:55 AM, 胡超 wrote: > > > class QdProjectAssist(models.Model): > ''

Re: Field.choices get all items as json

2018-05-20 Thread Peter of the Norse
Create a view that returns json. At least if you want to use it in an ajax way. Otherwise, I would recommend just passing it as an argument to the templates that use it. import json def years(request): return HttpResponse(json.dumps(dict(Model.YEAR_IN_SCHOOL_CHOICES)), content_type=‘appl

Re: Decorator function argument woes

2018-05-07 Thread Peter of the Norse
Yes, but that’s because all of the arguments are optional. That way you can do: @login_required def my_view(request): … @login_required(login_url=“/login/“) def other_view(request): … - Peter of the Norse > On Apr 30, 2018, at 12:24 AM, Mike Dewhirst wrote: > >> On 30/

Re: unexpected JSONField behavior clarification - key value pairs initially loaded integers, then saved down as strings into the database

2018-05-06 Thread Peter of the Norse
@googlegroups.com > <mailto:django-users+unsubscr...@googlegroups.com>. > To post to this group, send email to django-users@googlegroups.com > <mailto:django-users@googlegroups.com>. > Visit this group at https://groups.google.com/group/django-users > <https://groups.

Re: Use self-increasing arguments in numeric for-loop in Django

2018-05-03 Thread Peter of the Norse
can search the web and find many examples of people “solving” this non-problem. - Peter of the Norse > On Apr 20, 2018, at 7:49 AM, Bill Torcaso wrote: > > > I an new-ish to Django, and I ask this to hear from more experienced users > whether this would work at all, and whet

Re: chemistry character set

2018-03-15 Thread Peter of the Norse
the cleanup in the .save() method. My only advice is to use https://docs.python.org/3/library/stdtypes.html?highlight=translate#str.translate instead of multiple replaces. If you make the translation map a global variable, it is much faster. - Peter of the Norse > On Feb 15, 2018, at 5:55

Re: Migrating into Django 1.9; question about autoescape

2018-03-11 Thread Peter of the Norse
not get everything. > > This is a medium amount of effort, and if I make a mistake the users will > have a bad experience. > > Visit all of my code and all of my templates, carefully converting into the > world of autoescape-on. > Thanks in advance, > > --- Bill Torc

Re: django mathfiters

2018-02-27 Thread Peter of the Norse
I would do {% with a=42 c=b.value|default_if_none:0} - Peter of the Norse > On Feb 21, 2018, at 3:47 PM, Matthew Pava wrote: > > And how are you checking if it’s None? I would do it like this: > {% if c %} > {{ a|add:c }} > {% else %} > {{ a }} > {% endif %}

Re: Django Http request question.

2018-01-21 Thread Peter of the Norse
are starting out. The other questions are basic Python, and so I recommend you start with a tutorial. The official one is at https://docs.python.org/3/tutorial/, but I don’t know if it’s the best. - Peter of the Norse > On Jan 17, 2018, at 8:32 PM, cherngyo...@gmail.com wrote: > > I

Re: I can't install easy install

2018-01-09 Thread Peter of the Norse
This is the second time I’ve seen this and need to let you know it’s not true. PowerShell doesn’t have elevated permissions, it’s just bash for .NET. While there are a bunch of new scripting features built into it, it has no effect on Python* or any other commands you might run. - Peter of

Re: [ORM Foreign Keys][Performance] How to use Charfield Foreign Keys efficiently?

2017-12-21 Thread Peter of the Norse
model definition for CaseInfo2? - Peter of the Norse > On Nov 21, 2017, at 7:16 AM, Dominik Szmaj wrote: > > Hey, > > 'case_id' is a monkeypatch number(*) field so it works quick for now, not a > pk, but unique: > class OmEvent(Model): > case = Foreign

Re: Dynamic querysets?

2016-12-16 Thread Peter of the Norse
you are looking for `statedict.items()`. (Or `statedict.iteritems()` on py2) By default a dict just loops over the keys. And then it unpacks your two letter string into k, v. So the first step of your loop is k='A' and v='K'. Also, that's not how you use get. On 12/16/2016 4:19 PM, Malik R

Re: Django MongoEngine rest api app post request.POST.get('id')

2016-09-28 Thread Peter of the Norse
57545fd3-2460-44ee-8988-079998523a54%40googlegroups.com > > <https://groups.google.com/d/msgid/django-users/57545fd3-2460-44ee-8988-079998523a54%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <https://

Re: Format of arrays in multipart forms?

2016-09-27 Thread Peter of the Norse
PHP is stupid.  The problem with the [] syntax is that you have to be careful that the user hasn’t added or removed it from your fields.  This can cause problems if you were expecting an array and got a string, or vice-versa.Instead, name the fields without [], and in your Django code, use request.

Re: Query annotation with date difference

2016-09-04 Thread Peter of the Norse
I would use the DB NOW() function for this.  https://docs.djangoproject.com/en/1.9/ref/models/database-functions/#nowfrom django.db.models.functions import Now.annotate(ratio=(F(‘due_date')-Now())/F('Interval'))On Aug 3, 2016, at 3:34 PM, Constantine Covtushenko

Re: Questions about Deploying django for production using apache and mod_wsgi.

2016-06-26 Thread Peter of the Norse
oogle.com/group/django-users>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/50b71c19-10a1-4610-8050-191bde7facda%40googlegroups.com > > <https://groups.google.com/d/msgid/django-users/50b71c19-10a1-4610-8050-191bde7facda%40googlegroups.com?ut

Re: Passing hidden foreign key to form as initial value

2016-06-06 Thread Peter of the Norse
cr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/3628bd01-59b2-4291-94f5

Re: manipulate n insert field values

2016-06-04 Thread Peter of the Norse
> #take 3rd bit from y cordinate (longitude) : 0 > #take 3rd bit from x cordinate (lat) : 1 > > therefore z binary value is 100101 > and z value is 37 > > #this is the technique used to convert spatial 2D indexing to 1D to improve > efficiency. > > I do not know

Re: Django Multiple User Profiles Best Practices

2016-05-02 Thread Peter of the Norse
instead of a constant profile. What I would do, and I’d love to hear some debate about it, is put most (or all, depending on requirements) of the fields from the UserProfile in the new custom user model, and have two not-abstract profiles with one-to-one fields to the user. If the things in UserP

Re: Q() chaining with & returns empty set

2016-04-21 Thread Peter of the Norse
glegroups.com>. > To post to this group, send email to django-users@googlegroups.com > <mailto:django-users@googlegroups.com>. > Visit this group at https://groups.google.com/group/django-users > <https://groups.google.com/group/django-users>. > To view this discussion

Re: Django tutorial part 3 - question_id vs question.id

2016-04-16 Thread Peter of the Norse
gt; wrong. You can’t use _id. The closest is the foreign key ID. Peter of the Norse rahmc...@radio1190.org -- 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

Re: variable inside @media screen

2016-04-09 Thread Peter of the Norse
You also need a max-width or this will always be true. > On Mar 11, 2016, at 2:21 AM, Rose wrote: > > @media screen and (min-width:767px){ > Peter of the Norse rahmc...@radio1190.org -- You received this message because you are subscribed to the Google Groups "Django

Re: Problem uploading image Django 1.9 Python 3.5

2016-03-29 Thread Peter of the Norse
d01-bd6a-428f29466f4d%40googlegroups.com > > <https://groups.google.com/d/msgid/django-users/d89d4906-0494-4d01-bd6a-428f29466f4d%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/op

Re: help with ManyToMany

2016-01-31 Thread Peter of the Norse
s.google.com/group/django-users>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/7512817d-d348-48b2-abf1-f3f584650cce%40googlegroups.com > > <https://groups.google.com/d/msgid/django-users/7512817d-d348-48b2-abf1-f3f584650cce%40googlegroups.co

Re: Reverse Foriegnkey filtering

2016-01-30 Thread Peter of the Norse
it:: > >model1.objects.filter(model2__country=my_country) > > Cheers, > > Michal You also might need to follow up with .distinct() https://docs.djangoproject.com/en/1.8/ref/models/querysets/#django.db.models.query.QuerySet.distinct Peter of the Norse rahmc...@radio1190.org --

Re: self.publish.strftime('%m')

2016-01-30 Thread Peter of the Norse
self.publish.strftime('%m'), > self.publish.strftime('%d'), > self.slug]) > url(r'^(?P\d{4})/(?P\d{2})/(?P\d{2})/(?P[-\w]+)/$', > views.post_detail, name='post_detail'), > > i feel

Re: I'm missing something with Models and database migrations

2015-12-27 Thread Peter of the Norse
e Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com > <mailto:django-users+unsubscr...@googlegroups.com>. > To post to this group, send email to django-user

Re: django-admin.py startproject mysite

2015-11-10 Thread Peter of the Norse
000 I can see nothing it is not showing anything > > Actually I was giving this address cause wanted to see mysite from another > computer > and don't know why it is not working > Peter of the Norse rahmc...@radio1190.org -- You received this message because you are

Re: Models.clean() how to raise ValidationError WITH error_code and show field_based errors in the Form-Template?

2015-08-29 Thread Peter of the Norse
27;Now this is a valid one. P.S. I love django!' > model.name = 'Britney is gonna fail - Hit me Baby One More Time!' > model.clean() > model.save() > # validate that the error messages has the right code > the_exception = test

Re: Django Logical Deletes on Models

2015-08-08 Thread Peter of the Norse
ps.google.com/group/django-users > <http://groups.google.com/group/django-users>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/52a0b2b6-2fb6-44ad-9ab9-fd05613c1622%40googlegroups.com > > <https://groups.google.com/d/msgid/django-user

Re: Django formset hidden id field

2015-07-03 Thread Peter of the Norse
a database row that doesn’t involve the PK, I would love to know. Keep in mind that most tables only have the one unique identifier. Peter of the Norse rahmc...@radio1190.org -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscr

Re: Django formset hidden id field

2015-06-28 Thread Peter of the Norse
don’t want to use them publicly, because your competitors can use them to gauge your success, but that’s the kind of “Nice Problem to Have” that can wait until you’re bigger. > Thank you! Peter of the Norse rahmc...@radio1190.org -- You received this message because you are subscribed to th

Re: How to DRY, define a set of model-fields and reuse them as multiple instances

2015-06-14 Thread Peter of the Norse
thout having to manually add all > the fields. > > Any suggestions? There’s a django-compound-field package that seems to be what you want, but it hasn’t been updated in five years, so it won’t work with any recent version. Still, it might be a place to start from. Peter of the Norse r

Re: Scaling/Parallel patterns for a View executing complex database transaction

2015-06-14 Thread Peter of the Norse
are faster at key/value returns than PostgreSQL. Peter of the Norse rahmc...@radio1190.org -- 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 ema

Re: Migrating from sqllite3 to postgres

2015-05-25 Thread Peter of the Norse
;From sqlite: sqlite> .output backup.sql sqlite> .dump >From the command line: $ psql django_db -1f backup.sql You may have to edit the .sql file to make it work. Good luck. Peter of the Norse rahmc...@radio1190.org -- You received this message because you are subscribed to the G

Re: Changing table name in response to a QuerySet

2015-03-22 Thread Peter of the Norse
would normally generate. > > This may be one of those cases where the limitations of the ORM are being > reached, however, I'll defer any further comment to others on the list. > > -James > > > On Wed, Mar 18, 2015 at 9:35 PM, Peter of the Norse <mailto:rahmc.

Re: Different between Object-save and form-save

2015-03-18 Thread Peter of the Norse
ooglegroups.com>. > Visit this group at http://groups.google.com/group/django-users > <http://groups.google.com/group/django-users>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAMGzuy8aX8ehs4Qd2RgkueERA-OmDQg8gbE%3DVxJCB8heKw%2B03A%

Re: Changing table name in response to a QuerySet

2015-03-18 Thread Peter of the Norse
pHkndLWxi_8dCVamXJ-G7Bji3QZWcmA%40mail.gmail.com > > <https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXKkQ2Lpq1F-KBpHkndLWxi_8dCVamXJ-G7Bji3QZWcmA%40mail.gmail.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > &

Changing table name in response to a QuerySet

2015-03-16 Thread Peter of the Norse
r. The decision to choose which table to use is handled based on user settings. We would like to go back to just having the one Product model, and have its table name switch as necessary. Is there a way to do that? Peter of the Norse rahmc...@radio1190.org -- You received this message becau

Re: Webcomponents in Django

2014-12-18 Thread Peter of the Norse
his time in a different file, so it creates the new link as http://127.0.0.1/designer/elements/designer-element/elements/designer-element/designer-element.html and the process starts all over again. This isn't a Django problem but an HTML problem. -- Peter of the Norse -- You received this

Re: How to urlquote backslash in reverse arguments

2014-01-15 Thread Peter of the Norse
legroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a55c505d-e7d2-4a85-aade-761913d544e9%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Pete

Re: export .csv file from database

2013-07-19 Thread Peter of the Norse
self.queue.truncate(0) > > def writerows(self, rows): > for row in rows: > self.writerow(row) > > The above code is exporting the database data into .csv file. > > Problem i am facing is,the exported data like Filename,Description,Notes >

Re: Django queryset 'in' operator fails on first call

2013-04-13 Thread Peter of the Norse
I get the correct result first time using prefetch_related? > You might try converting the QuerySet into a list first. QuerySets avoid actually caching data for as long as possible. Peter of the Norse rahmc...@radio1190.org -- You received this message because you are subscribed to the

Re: How to get ten random records

2013-03-22 Thread Peter of the Norse
case where the raw SQL interface might be the right answer: >> you can just tack an ORDER BY random() clause onto the query. > > Thank you kind sir > > Cheers > > Mike > >> >> -- -- Christophe Pettus x...@thebuild.com >> > Peter of the Norse

Re: Performance when retrieving data from related models

2013-03-18 Thread Peter of the Norse
More inline stuff. On Mar 18, 2013, at 4:14 AM, Taras D wrote: > Hi Peter > > On 18 March 2013 16:35, Peter of the Norse wrote: > You’re over thinking this by a large margin. getTendersForContractor should > return a QuerySet. That way you can add things like .select_related

Re: Performance when retrieving data from related models

2013-03-17 Thread Peter of the Norse
lse to match it. Most of us just use the ORM as the data retrieval layer. Again, I’m worried you’re over thinking this. Peter of the Norse rahmc...@radio1190.org -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Re: IntegrityError after updating to custom user field: django_admin_log still has fk to auth_user

2013-03-02 Thread Peter of the Norse
insert or update on table "django_admin_log" violates foreign > key constraint "django_admin_log_user_id_fkey" > DETAIL: Key (user_id)=(2) is not present in table "auth_user". > > -- > You received this message because you are subscribed to the Googl

Re: How to make django's mysql connections to use utf8mb4 ?

2013-02-18 Thread Peter of the Norse
m/d/msg/django-users/-/XMNArBaFugEJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en. -- Peter

Re: Object composition in django

2013-02-17 Thread Peter of the Norse
s" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To post to this group, send email to django-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/d

Re: django generate pdf with tables and charts

2013-02-13 Thread Peter of the Norse
of > javascript code. I have tried PISA, ReportLib and wkhtmltopdf but it seems > that it doesn't wait for Javascript. > > Can someone suggest good solution or example? > Peter of the Norse rahmc...@radio1190.org -- You received this message because you are subscribed to the

Re: initial argument in forms not working for me

2013-01-31 Thread Peter of the Norse
re subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/g

Re: Polls tutorial receive object not object representation

2013-01-31 Thread Peter of the Norse
c.poll > Out[15]: > > In [16]: p.choice_set.all() > Out[16]: [, , object>, ject>] > > Thanks > Sayth Did you add an __unicode__ method to Choice class? That's how you get the pretty representations of objects. https://docs.djangoproject.com/en/1.4/intro/tutoria

Re: Setting urls from project

2013-01-18 Thread Peter of the Norse
, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en. -- Peter of the Norse -- You received this message becau

Re: HTML Source on Browser Rendering

2013-01-13 Thread Peter of the Norse
com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > > -- > Stavros > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discus

Re: Multiple model inheritance

2013-01-05 Thread Peter of the Norse
o-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > Peter of the Norse rahmc...@radio1190.org -- You received this message because you are subscribed to the Google Groups "Django users&quo

django-users@googlegroups.com

2013-01-05 Thread Peter of the Norse
n formset.errors.items %} > {{ x }} : {{ y }} > {% endfor %} > {{ errors }} > > {% endif %} > > Searching by dish names, locations, and restaurants is > case-insensitive. > Searching by course uses case-insensitive exact matching. Valid

Re: ImportError at/ No module name

2012-12-24 Thread Peter of the Norse
'/usr/lib/python2.7/dist-packages/PIL', > '/usr/lib/python2.7/dist-packages/gst-0.10', > '/usr/lib/python2.7/dist-packages/gtk-2.0', > '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', > '/usr/lib/python2.7/dist-packages/ubuntuone-clie

Re: count resulting rows in sliced valuesqueryset

2012-11-26 Thread Peter of the Norse
/models/querysets/#reverse On Nov 24, 2012, at 4:06 PM, ?manu* wrote: > On Saturday, November 24, 2012 8:03:06 AM UTC+1, Peter of the Norse wrote: > On Nov 21, 2012, at 3:53 AM, ?manu* wrote: > > > Suppose I have a queryset qs. For paginating purposes I need to do >

Re: overwrite field value in subclasses

2012-11-25 Thread Peter of the Norse
tomatically" set to UpperAbstract.CHOICE_A > In my test the created object as null value and saving it is refused on > IntegrityError because 'myfield' cannot be None > > thank in advance for any help. > regards > > manu > Peter of the Norse rahmc...@radio1190.

Re: count resulting rows in sliced valuesqueryset

2012-11-23 Thread Peter of the Norse
query. However I don't see how to construct a ValuesQueryset with > a raw SQL code... sql, params = qs.query.sql_with_params() s = ValuesQuerySet.objects.raw('SELECT COUNT(*) OVER() , subquery.* FROM ('+sql+') AS subquery', params); see https://docs.djangoproject.com/en/

Re: Should we have a database independent SQL like query language in Django?

2012-11-18 Thread Peter of the Norse
quot; group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/cQW4Vpc9ueYJ. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. >

Re: Autoescape of & char ignoring safe filter

2012-11-16 Thread Peter of the Norse
I know this is months old, but I've been working on my back log. First of all, you should be using & in your URLs. They will get unescaped by the browser and show up as & when you click the link. This is so commonly overlooked that the browser will automatically escape them when loading. Then

Re: 'NoneType' object has no attribute 'datetime' bug?

2012-08-14 Thread Peter of the Norse
. > end_date= models.DateTimeField(default=None, null=True, blank=True) > > > def close_coupon(self): > > current_date = datetime.datetime.now() > today = datetime.datetime.combine(datetime.date.today(), > datetime.time(19,30)) > >

Re: setting up new django project

2012-06-20 Thread Peter of the Norse
On 5/27/2012 8:53 PM, xaegis wrote: Hello, this is my first time posting to a list! I am running python 2.7 with django 1.4 installed on Ubuntu 12.04 I am having trouble creating new projects with django. Whenever I use the command: Code: sudo /usr/local/lib/python2.7/dist-packages/django/bin/

Re: Python FAQ: Webdev

2012-06-07 Thread Peter of the Norse
of Django goes unused. If you do need to save data, then you'll love ModelForms. I like that Django has everything I need and that they all work together. But if you'd rather use MongoDB, then it's every difficult. Peter of the Norse rahmc...@radio1190.org -- You received th

Re: How to perform a simple search ignoring characters with accents (á, é, í, ó, ú)

2012-06-04 Thread Peter of the Norse
end email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. Peter of the Norse rahmc...@radio1190.org -- You receive

Re: Adding values to formdata of ModelForm before saving

2012-06-03 Thread Peter of the Norse
re subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/WyKASDjYNEgJ. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send

Re: Django ModelForm user best practices

2012-06-02 Thread Peter of the Norse
t; I'm sure there are more ways to achive the same result. > What are your thoughts on that ? > > When should I 'hide' (by using HiddenInput() widget) ModelForm fields? when > should I save them directly > in view? > > Does it all depend on needs or maybe there a

Re: Error with Views on Admin and Index page

2012-05-27 Thread Peter of the Norse
for rock and roll >>>> I never look back >> >>>> I'm a rocker >>>> Do as I feel as I say >>>> I'm a rocker >>>> And no one can take that away >> >>> -- >>> You received this message because you

Re: model form_set can not delete

2012-05-26 Thread Peter of the Norse
end email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. Peter of the Norse rahmc...@radio1190.org -- You received this message because you are subscribed to the Google Groups "Dj

Re: TypeError Exception Value: coercing to Unicode: need string or buffer, dict found

2012-05-26 Thread Peter of the Norse
;Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl

Re: Need help

2012-05-02 Thread Peter of the Norse
> For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > -- > 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@goo

Using “Schemas” with MySQL

2012-03-22 Thread Peter of the Norse
round. I’ve seen that in PostgreSQL you can use db_table = 'schema\".\"tablename' Does something similar work in MySQL? Has anyone tried it? Peter of the Norse rahmc...@radio1190.org -- You received this message because you are subscribed to the Google Groups "Django users

Re: save() creates new entry instead of updating the passed on as instance

2012-03-12 Thread Peter of the Norse
> To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. Peter of the Norse rahmc...@radio1190.or

Re: Problem getting django on mac (10.5/Leopard) working

2012-02-05 Thread Peter of the Norse
nse" for more information. >>>>>>> import django >>>> Traceback (most recent call last): >>>> File "", line 1, in >>>> ImportError: No module named django >> >>>> What am I missing or doing wrong? >> &

Re: Views in django

2012-02-04 Thread Peter of the Norse
t; > When all this is applied, it creates a view out of 2 tables i.e Amount > and ClientJob without using foreign key. Now I want to have sum of the > total and net_total fields for the views generated. Peter of the Norse rahmc...@radio1190.org -- You received this message because you ar

Re: many-to-many queryset question

2012-01-06 Thread Peter of the Norse
e you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at &g

Re: com_error

2011-11-25 Thread Peter of the Norse
(_GetGoodDispatch(IDispatch, clsctx), userName) >> File "C:\Python27\lib\site-packages\win32com\client\dynamic.py" in >> _GetGoodDispatch >> 85.IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, >> pythoncom.IID_IDispatch) >> Exception Type

Re: order by + group by

2011-09-16 Thread Peter of the Norse
you want to include, you’ll have to get raw. The SQL will look like “SELECT * FROM a AS t1 WHERE mod = (SELECT MIN(mod) FROM a AS t2 WHERE t2.name = t1.name))”. Finding out the exact details depends on the specifics of your queryset. https://docs.djangoproject.com/en/1.3/topics/db/a

Re: order by + group by

2011-09-13 Thread Peter of the Norse
t; ) > > in the ORM? Specifically, I want to express > > SELECT ... FROM ( >SELECT ... FROM app_model >ORDER BY field1 > ) > GROUP BY field2 > > Is it possible without writing SQL by hand? > > Thanks, > Jonas Peter of the Norse rahmc...@ra

Re: multiple filters on the same (reversed) foreignkey leads to multiple join

2011-09-07 Thread Peter of the Norse
quot;) > INNER JOIN "t0_child" T4 > ON ("t0_base"."id" = T4."base_id") > WHERE ("t0_child"."flag1" = True AND T3."flag2" = True AND > T4."flag1" = False ) > > I don't think that this is the e

Re: problems with request.user

2008-08-28 Thread Peter of the Norse
API has recently changed? I've scoured >>> the latest online documentation, and can't seem to find any >>> alternate >>> way to access the ID of the currently logged in user. Any help is >>> app

Re: return django models using custom sql

2008-08-26 Thread Peter of the Norse
on from http://docs.djangoproject.com/en/dev/ref/models/querysets/ Using it may cause unexpected results. Check that the SQL it generates is what you want, and it might not work with your model. -- Peter of the Norse --~--~-~--~~~---~--~~ You received this mes

Re: InlineModelAdmin min_num ?

2008-08-18 Thread Peter of the Norse
Perhaps you’re thinking of `extra`? On Aug 13, 2008, at 9:24 PM, mike wrote: > InlineModelAdmin has max_num , shouldn't it have a min_num or am I > missing something? > > Thanks, > -Mike -- Peter of the Norse --~--~-~--~~~---~--~~ You r

Re: Django Setup with apache & mod_python

2008-07-03 Thread Peter of the Norse
the documentation states "… > and replace mysite.settings with the Python import path to your Django > project’s settings file." <-- would this be the full path to the > settings.py file? > > I tried this and all I'm getting is a blank page - for every U

  1   2   >