Select Boxes and Database

2023-12-02 Thread David Merrick
table is cities with populations and the foreign key of Countries table. Then having chosen Auckland a city in New Zealand I want to display Country City Population In a template. I have done this in Php, Javascript and Mysql already. Cheers Dave -- Dave Merrick TutorInvercargill http

Re: Domain Names and Web Servers

2020-05-08 Thread David Merrick
/ but Domain4less can't use Dynamic IP address so the two are related sorry. On Sat, May 9, 2020 at 10:14 AM Kasper Laudrup wrote: > Hi David, > > On 08/05/2020 23.18, David Merrick wrote: > > Hi, I am interested in what web servers can be used for Django Web Apps > > and whether th

Domain Names and Web Servers

2020-05-08 Thread David Merrick
Hi, I am interested in what web servers can be used for Django Web Apps and whether the Domain Name Servers are Static or Dynamic. Static Domain Name Servers (DNS) the IP Address doesn't change and Dynamic (DNS) IP Address does change. -- You received this message because you are subscribed

Re: Django Lessons

2020-05-08 Thread David Merrick
I am asking about web hosting and appropriate Domain Name Servers On Fri, May 8, 2020 at 9:18 PM David Merrick wrote: > Same Domain Name Servers can only handle > static DNS server > https://ticket.cdmon.com/en/support/solutions/articles/706124-what-is-a-static-dns-server-

Re: Django Lessons

2020-05-08 Thread David Merrick
"and what > domain names / types" ? > > On Friday, May 8, 2020 at 8:33:43 AM UTC+2, David Merrick wrote: >> >> Sounds like a very good idea. >> I have one immediate question. What web servers can host Django and what >> Domain Names / types? >> I was usi

Re: Django Lessons

2020-05-08 Thread David Merrick
a3d-45ea-b43d-6d22b54469b2%40googlegroups.com?utm_medium=email_source=footer> > . > -- Dave Merrick TutorInvercargill http://tutorinvercargill.co.nz Daves Web Designs Website http://www.daveswebdesigns.co.nz Email merrick...@gmail.com Ph 03 216 2053 Cell 027 3089 169 -- You receiv

Re: CSRF token still needed today?

2020-04-21 Thread David Merrick
t default for cookies (SameSite=Lax)? > > Am Montag, 20. April 2020 14:43:10 UTC+2 schrieb David Merrick: >> >> if you want cross site forgery requests get rid off it >> >> On Mon, Apr 20, 2020 at 10:45 PM Andréas Kühne >> wrote: >> >>> Why is it

Re: CSRF token still needed today?

2020-04-20 Thread David Merrick
o view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAK4qSCeO0bkxsGYFc7t-V7%2BZnr965gYAG0oALB0ELtoJjojedg%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAK4qSCeO0bkxsGYFc7t-V7%2BZnr965gYAG0oALB0ELtoJjojedg%40mail.gmail.com?utm_mediu

Re: how to add a field to a model form when the field is not in the model

2010-04-07 Thread Merrick
') def __init__(self, *args, **kw): self.request = kw.pop('request') super(SomeForm, self).__init__(*args, **kw) On Apr 7, 10:19 am, Merrick <merr...@gmail.com> wrote: > I appreciate all of the help, I was actually showing both Daniel and > Raj that their suggestio

Re: how to add a field to a model form when the field is not in the model

2010-04-07 Thread Merrick
a suggestion aside from that? Thanks. On Apr 7, 10:07 am, Tom Evans <tevans...@googlemail.com> wrote: > On Wed, Apr 7, 2010 at 5:30 PM, Merrick <merr...@gmail.com> wrote: > > Thank you. > > > I'll be more specific, here is what I have: > > > views.py > >

Re: how to add a field to a model form when the field is not in the model

2010-04-07 Thread Merrick
wrote: > On Apr 7, 8:05 am, Merrick <merr...@gmail.com> wrote: > > > How should I go about adding a field to a model form > > when the field is not part of the model? > >  Define a Custom ModelForm by specifying model in Meta and declare the > required addnl field there.

how to add a field to a model form when the field is not in the model

2010-04-06 Thread Merrick
I added a checkbox form field to my template, and I even tried to add it in my forms.py and then in my views.py I check for it like so: if form.cleaned_data['checkbox_field']: code to send email... But when I submit the form I get a KeyError. How should I go about adding a field to a model

Restricting Access to Uploaded Files

2010-03-03 Thread Merrick
I wanted to give users who are authenticated the ability to upload files, that's the easy part that I can handle. What I cannot figure out is how to restrict the viewing/downloading of files. Links, tips, code are appreciated. Thanks -- You received this message because you are subscribed to

Re: Efficient way to Display Comments with Threaded Replies

2010-03-02 Thread Merrick
ent_list': comment_list}) > > in "view_post.html" you'll be able to choose indentation by second > item of the tuple, which is in the comment_list variable. I'm sorry if > there are errors, I didn't validate that code, this is just an idea. > > On 2 ÍÁÒ, 09:53, Merrick <mer

Efficient way to Display Comments with Threaded Replies

2010-03-01 Thread Merrick
I have a comments model that is setup to do threaded replies. I am having trouble figuring out how to display the comments in a threaded manner, i.e. tree. My model looks like this: class Comment(models.Model): post = models.ForeignKey(Post, null=True, blank=True) user =

Re: Separate a project into 2 - both need to access the same models

2009-09-16 Thread Merrick
Got it thanks, I'll try it out. On Sep 15, 11:47 pm, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Sep 16, 6:45 am, Merrick <merr...@gmail.com> wrote: > > > > > I have a project that I am thinking of breaking up into 2 sites/ > > projects. The goal is to

Separate a project into 2 - both need to access the same models

2009-09-15 Thread Merrick
I have a project that I am thinking of breaking up into 2 sites/ projects. The goal is to be able to make changes to one site/project without affecting the other one. Here is an example of what each would do: mydomain.com - - displays the brochure website (sales copy on the

Re: Modify the value in a row before returning through a query

2009-08-24 Thread Merrick
yourmodel (models.Model): domain = models.URLField(...) @property def strippeddomain (self): return stripdomain(self.domain) Then from the shell this works: >>> url = yourmodel.objects.get(id=1) >>> url.strippeddomain u'yourdomain.com' On Aug 24, 3:37

Re: Modify the value in a row before returning through a query

2009-08-24 Thread Merrick
Looks like we were writing at the same time. I also was not aware you could call a model method in a template without the parenthesis, that's where I was getting hung up. Again thank you. On Aug 24, 3:54 pm, Javier Guerra <jav...@guerrag.com> wrote: > On Mon, Aug 24, 2009 at 5:37 PM

Re: Modify the value in a row before returning through a query

2009-08-24 Thread Merrick
url.stripdomain() returns: yourdomain.com Do you know if there is a way to have url.domain return what stripdomain() did above? Otherwise I'll use a template filter and move on. Merrick On Aug 24, 12:20 pm, Javier Guerra <jav...@guerrag.com> wrote: > On Mon, Aug 24, 2009 at 1:42 PM

Re: Modify the value in a row before returning through a query

2009-08-24 Thread Merrick
missing something? On Aug 24, 11:05 am, Javier Guerra <jav...@guerrag.com> wrote: > On Mon, Aug 24, 2009 at 1:01 PM, Merrick<merr...@gmail.com> wrote: > > I know how to parse the URL but am drawing a blank on how to > > accomplish this at the model level. > > add a f

Modify the value in a row before returning through a query

2009-08-24 Thread Merrick
I have this in models.py: domain = models.URLField(...) Let's say one row in the table has this for domain: 'http://www.google.com' When the domain field is looked up, I would like to return: www.google.com I know how to parse the URL but am drawing a blank on how to accomplish this at the

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread Merrick
I am using S3Storage with an imagefield successfully. It sounds like you have not specified the storage engine and keys etc... in settings.py as creecode pointed out. I recall testing that the directory will be created on the fly if it does not exist. On Jan 19, 12:40 pm, creecode

Re: S3Storage.py and Thumbnails using PIL (IOError / cannot identify image file)

2008-12-22 Thread Merrick
of new_profile = pform.save(commit=False) new_profile.picture.save(filename, thumbnail_content) Merrick On Dec 22, 1:10 pm, brianmac44 <anon1...@gmail.com> wrote: > With my code, what are you using as "content"? > > I'm using: form.cleaned_data['source'].read() > >

Re: S3Storage.py and Thumbnails using PIL (IOError / cannot identify image file)

2008-12-22 Thread Merrick
gt; > Hope this helps. > > -Brian > > On Dec 22, 4:41 am, Merrick <merr...@gmail.com> wrote: > > > Thank you I tried that and I still get the same error. > > > I spent a little more time looking at PIL / Image.py and cleaning up > > the code. From what

Re: S3Storage.py and Thumbnails using PIL (IOError / cannot identify image file)

2008-12-22 Thread Merrick
Thank you I tried that and I still get the same error. I spent a little more time looking at PIL / Image.py and cleaning up the code. From what I can tell the Image.open method is having trouble with what I am passing to it. def resize_image(file, size=(50, 50)): from PIL import Image

S3Storage.py and Thumbnails using PIL (IOError / cannot identify image file)

2008-12-19 Thread Merrick
I setup S3Storage as my default storage and can successfully upload images to S3 without overriding save on my profile_update below. Right now, when I submit a form with an image I get the original image uploaded in my S3 bucket not a thumbnail and an IO Error - "cannot identify image file" -

Re: Update Values to Null

2008-11-17 Thread Merrick
But of course! Thank you. On Nov 17, 8:25 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Mon, Nov 17, 2008 at 9:06 PM, Merrick <[EMAIL PROTECTED]> wrote: > > > I cannot figure out how to update a foreign key to a null value. > > Thanks

Update Values to Null

2008-11-17 Thread Merrick
I cannot figure out how to update a foreign key to a null value. Thanks. models.py group = models.ForeignKey(group, null=True, blank=True) >>> from redirect.models import * >>> Links = Link.objects.filter(group = 6) >>> Links.update(group = NULL) Traceback (most recent call last):

Re: avoid cascade delete

2008-11-17 Thread Merrick
> On Sun, 16 Nov 2008 23:21:05 -0800 (PST), Merrick <[EMAIL PROTECTED]> > > declared: > >> I have two models, links and groups. A Link has an optional foreign > >> key Group. > > >> When I delete a Group, Django by default deletes all Links that > &

avoid cascade delete

2008-11-16 Thread Merrick
I have two models, links and groups. A Link has an optional foreign key Group. When I delete a Group, Django by default deletes all Links that referenced the Group that is being deleted. How do I avoid the default behavior that does a cascade delete. Of course I could use the cursor but would

access request.user in class Meta

2008-11-01 Thread Merrick
(request=request) The error I get makes it clear I don't have access to request within class Meta: NameError at / name 'self' is not defined Thanks, Merrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "D

access request.user in clean method of ModelForm

2008-10-31 Thread Merrick
How can I access request.user in a clean method of a ModelForm? I have the following code in forms.py: === #profle email form class UserEmailForm(ModelForm): class Meta: model = User fields = ['email',] def clean_email(self): email_submitted =

Access request.user in a clean method of a ModelForm

2008-10-31 Thread Merrick
I have the code below: === class UserEmailForm(ModelForm): class Meta: model = User fields = ['email',] def clean_email(self): email_submitted = self.cleaned_data.get('email') email_exists =

Plot Location of IP Addresses on a Google Map

2008-10-11 Thread Merrick
I think it might be overkill to use GeoDjango, anyone else know of a module I can use for this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Double encoded slash in path_info removed when using apache/wsgi

2008-10-09 Thread Merrick
Thank you Graham, I was going crazy trying to figure this out. Thankfully I control my hosting environment top to bottom (colocation) so I will try using REQUEST_URI I will use it. On Oct 8, 3:00 am, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Oct 8, 5:57 pm, Merrick <[EMA

Re: Double encoded slash in path_info removed when using apache/wsgi

2008-10-08 Thread Merrick
Could this problem be in the wsgi.py handler in django? If not I suppose I need to look at mod_wsgi and quit asking here :) On Oct 7, 4:05 pm, Merrick <[EMAIL PROTECTED]> wrote: > I need urls that contain other urls within them i.e. > > http://mydomain.com/find/http%3A%2F%2Fwww.

Double encoded slash in path_info removed when using apache/wsgi

2008-10-07 Thread Merrick
n urls.py up until this point because it is not related to this problem from what I can tell, but in case you are wondering I was trying to capture the url after find/ - my regex looks like this r'^find/(?P(.*))$' Thanks for looking at this, Merrick --~--~-~--~~~---~--~---

Re: Regex pattern for URL matching

2008-10-06 Thread Merrick
I think this is related to WSGI. On Oct 6, 7:17 pm, Merrick <[EMAIL PROTECTED]> wrote: > That is the approach I took and how I resolved the original problem > with the 404. It led me to find that "AllowEncodedSlashes On" in > Apache is needed for encoded slashes to b

Re: Regex pattern for URL matching

2008-10-06 Thread Merrick
Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2008-10-06 at 16:10 -0700, Merrick wrote: > > keith, thanks for trying. > > > %2f is the encoded value of /, but urls contain other characters as > > well not just alphanumeric. > > I think you're debugging the wrong piec

Re: Regex pattern for URL matching

2008-10-06 Thread Merrick
%2Fwww.wired.com%2F I am able to capture the URL, but with only one slash. I pass it to my ModelForm and it prints in my template as: http:/www.wired.com/ Note the lack of double forward slashes after the colon. On Oct 6, 4:10 pm, Merrick <[EMAIL PROTECTED]> wrote: > keith, thanks for trying

Re: Regex pattern for URL matching

2008-10-06 Thread Merrick
, i think you could add the % to the regex  (i'm hardly a > regex master): > > r'^find/(?P[%-\w]+)$ > > keith > > On Mon, Oct 6, 2008 at 7:05 PM, Merrick <[EMAIL PROTECTED]> wrote: > > > I have narrowed down the problem to %2F in my url, anyone? > > >

Re: Regex pattern for URL matching

2008-10-06 Thread Merrick
I have narrowed down the problem to %2F in my url, anyone? On Oct 6, 2:55 pm, Merrick <[EMAIL PROTECTED]> wrote: > \w will only match alphanumeric characters, I need to match anything > and will let my modelform verify that it is indeed a URL. > > On Oct 6, 2:43 pm, Merrick

Re: Regex pattern for URL matching

2008-10-06 Thread Merrick
if APPEND_SLASH = True.  the regex should look like: > >     r'^find/(?P[-\w]+)/$' > > should be urls.py too, not views.py. > > keith > > On Mon, Oct 6, 2008 at 1:17 PM, Merrick <[EMAIL PROTECTED]> wrote: > > > I am trying to figure out how to match / capture

Re: Regex pattern for URL matching

2008-10-06 Thread Merrick
\w will only match alphanumeric characters, I need to match anything and will let my modelform verify that it is indeed a URL. On Oct 6, 2:43 pm, Merrick <[EMAIL PROTECTED]> wrote: > Thank you, I meant urls.py. APPEND_SLASH = False so I omitted the > trailing slash from the regex

Regex pattern for URL matching

2008-10-06 Thread Merrick
I am trying to figure out how to match / capture a URL. views.py === urlpatterns = patterns('', url(r'^find/(?P(.*)$', view = 'myapp.views.find', name = 'find' ), when I enter in this address: mydomain.com/find/www.wired.com my view / template are executed, but if

Re: capture form input even after ValueError exists

2008-10-01 Thread Merrick
:49 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On Wednesday 01 October 2008 01:35:55 am Merrick wrote: > > > All is not lost if a user enters an invalid code I still want to do > > something with just the url, but I cannot get > > form.cleaned_data.get('url')

capture form input even after ValueError exists

2008-09-30 Thread Merrick
My ModelForm has two input fields url and code, and I raise a ValidationError if the code contains anything other than letters, numbers and dashes. My logic looks something like this: if form.is_valid(): ... return render_to_response('new.html', {'code': new.code}) if ValueError: if

Re: question about return value when selecting next id from postgresql using nextval

2008-09-30 Thread Merrick
that the L stood for long, anyhow this works: id = int(row[0] encode_id(id) On Sep 30, 7:15 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2008-09-30 at 15:08 -0700, Merrick wrote: > > If I run the following query on psql: > > > SELECT nextv

question about return value when selecting next id from postgresql using nextval

2008-09-30 Thread Merrick
If I run the following query on psql: SELECT nextval('redirect_link_id_seq'); it returns an integer, say 5 when I do the following with the django shell I get a different result: >>> def get_next_id(): ... cursor = connection.cursor() ... cursor.execute("SELECT

how to get CURRVAL()

2008-09-19 Thread Merrick
I have a function in my model where I need the next sequence id from postgresql so i can create an encoded value based off it. Any ideas on how to do this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Store referer to form in database

2008-09-17 Thread Merrick
I have a form on the homepage of mydomain.com that instructs people to submit their email address and we'll notify them when we launch our service. For those visitors that submit the form, I want to store the referer. I am able to print out the HTTP_REFERER on the same template as the form but I

Re: get_absolute_url() using related models slugs

2008-04-25 Thread Merrick
= 'photo_detail', ), On Apr 24, 11:43 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Thu, Apr 24, 2008 at 12:21 PM, Merrick <[EMAIL PROTECTED]> wrote: > > > Thank you, I updated get_absolute_url to take into consideration the > > fact that I was erroneousl

Re: get_absolute_url() using related models slugs

2008-04-24 Thread Merrick
er' object has no attribute 'place' On Apr 24, 8:59 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2008-04-24 at 08:55 -0700, Merrick wrote: > > [...] > > > ***Shell output > > > >>> from photologue.models import * > > >>>

Re: get_absolute_url() using related models slugs

2008-04-24 Thread Merrick
nnick <[EMAIL PROTECTED]> wrote: > On Thu, 2008-04-24 at 08:55 -0700, Merrick wrote: > > [...] > > > ***Shell output > > > >>> from photologue.models import * > > >>> photo = Photo.objects.get(slug='golf-course-3') > > >>> p

get_absolute_url() using related models slugs

2008-04-24 Thread Merrick
I am still learning Django, and appreciate all of the help I have received. I spent a few hours on this and just cannot figure out how to pull off the get_absolute_url() function the way I describe it below for the Photo class. I want to use the slugs for related models and step through multiple

Re: best practice for creating featured field

2008-04-20 Thread Merrick
Thank you, I had various as errors as you pointed out and as soon as I implemented your suggestions and reset the database it all works now. On Apr 20, 8:43 am, Peter Rowell <[EMAIL PROTECTED]> wrote: > > featured_place = models.ForeignKey(Place, null=true, blank=true) > > 1. By any chance

Re: best practice for creating featured field

2008-04-19 Thread Merrick
Oops my featured_place actually reads: featured_place = models.ForeignKey(Place, null=true, blank=true) On Apr 19, 9:57 pm, Merrick <[EMAIL PROTECTED]> wrote: > I updated the City model: > > class City(models.Model): > state = models.ForeignKey(State) &g

Re: best practice for creating featured field

2008-04-19 Thread Merrick
' is not defined sorry for all the help requests here. On Apr 19, 9:41 pm, Merrick <[EMAIL PROTECTED]> wrote: > Thank you, I originally had featured_place as a foreign key and ran > into a problem: > > null value in column "featured_id" violates not-null constrain

Re: best practice for creating featured field

2008-04-19 Thread Merrick
Thank you, I originally had featured_place as a foreign key and ran into a problem: null value in column "featured_id" violates not-null constraint That is because before there is a place there has to be a city. On Apr 19, 9:37 pm, Doug B <[EMAIL PROTECTED]> wrote: > > What is the best

best practice for creating featured field

2008-04-19 Thread Merrick
I am using the admin to do all of my data input. I have the following models: class City(models.Model): city = models.CharField(max_length=100, unique=True) class Place(models.Model): city = models.ForeignKey(City) title = models.CharField(max_length=255) is_featured =

Re: ProgrammingError with PostgreSQL: operator does not exist: integer ~~* unknown

2008-04-19 Thread Merrick
, 2008-04-18 at 17:26 -0700, Merrick wrote: > > I get the same problem as described here: > > > #6523 > >http://code.djangoproject.com/ticket/6523 > > > There is a diff file which says it fixes the problem, how should I > > proceed? If implement the diff,

ProgrammingError with PostgreSQL: operator does not exist: integer ~~* unknown

2008-04-18 Thread Merrick
I get the same problem as described here: #6523 http://code.djangoproject.com/ticket/6523 There is a diff file which says it fixes the problem, how should I proceed? If implement the diff, anyone care to tell me how please. --~--~-~--~~~---~--~~ You received this

Re: Prepopulate Slugfied from Foreign Key without using the id

2008-04-17 Thread Merrick
he id's of the SiteSections as the key and the url > that I'm using to prepopulate text box (hence the reason this is a django > template file and not a plain javascript file). > > Overall it's pretty close to what you are wanting to do though. > > Hope that helps, > --James

Re: Prepopulate Slugfied from Foreign Key without using the id

2008-04-17 Thread Merrick
Hi James, thank you for responding, can you point me in the right direction with the javascript. --Merrick On Apr 17, 1:25 pm, "James Punteney" <[EMAIL PROTECTED]> wrote: > I ran into this issue the other day wanting to use a foreign key value to > prepopulate a slugf

Prepopulate Slugfied from Foreign Key without using the id

2008-04-17 Thread Merrick
is not compatible with new-forms admin thus local flavor is also not an option. Thanks. -Merrick class State(models.Model): state = models.CharField(max_length=100, unique=True) class Admin: pass def __str__(self): return self.state class Meta: ordering = ['state