[no subject]

2019-06-17 Thread Herman
how do I solve thsi kind of operational error on windows
'django.db.utils.OperationalError: FATAL:  password authentication failed
for user "hp" '?

-- 
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 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/CACq2e44kWP8dVvLrMYwowrkF%3DLKQLB_2a570wf1VWPk-Jq5juQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: syntax highlighting for template files and file suffix

2011-08-23 Thread Herman Schistad
On Tue, Aug 23, 2011 at 13:09, Gelonida N <gelon...@gmail.com> wrote:
> I'm rather new to Django and just start working with a little more with
> templates.
>
> I wondered how to make a distinction between html files and html templates.
>
> Shall I used different suffixes or is the directory location enough.
>
> If I don't have different file suffixes, how do you teach your editor,
> when editing an html file and when editing a template file.

If say you have all the .html files in your templates/ folder, it
should all be good. Suffix is .html

Best practice I guess is to create as base.html which defines your
structure, and say:
(...)

{% block content %}{% endblock %}

(...)

And later in another document you just define the content like this:
{% extends "base.html" %}
(...)
{% block content %}
Your custom content here.
{% endblock %}
(...)

-- 
With regards, Herman Schistad

-- 
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@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.



Re: Django 1.4?

2011-08-05 Thread Herman Schistad
On Fri, Aug 5, 2011 at 15:01, Littke <jonatan.lit...@gmail.com> wrote:
> Hi.
> Is there a schedule/roadmap for the release of Django 1.4?
> If not, how far away would you guesstimate it is?

Here is the roadmap wiki:
https://code.djangoproject.com/wiki/Version1.4Roadmap

Which is pretty empty, but you can sort the tickets by milestone and
get an overview:
https://code.djangoproject.com/query?milestone=1.4=id=summary=status=owner=type=milestone=priority

Also, 1.2 was released May 17th 2010
1.3 was released March 23rd 2011 ... so almost a year (although that
may not happen 1.3 -> 1.4)

-- 
With regards, Herman Schistad

-- 
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@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.



Google AppEngine vs. dedicated hosting (Pros/cons)

2011-08-05 Thread Herman Schistad
Hello.

I'm developing a site with approx. 500 visits per day, mainly from
Norway (Europe).

Now I'm trying to find the best possible way to host this site.
Earlier I've used dedicated hosts like WebFaction and Djangoeurope,
and this has worked pretty well.
However Google AppEnginge is free and provides a really reliable
server (as far as I can tell). But I'm no expert on this matter and
therefore come to you guys.

What is the tradeoff between using Google AppEngine (with
django-nonrel [1]), learning this, and writing my application for the
Google datastore versus using a traditional host.
Are there any big challanges by using AppEngine?

A third alternative would to maybe invest in e.g. dedicated virtual
machine at MediaTemple[2] or something.

So what it all boils down to: which is your preffered hosting method,
and why/why not?
- Google AppEngine
- Dedicated django hosting (e.g. WebFaction[3])
- Virtual server/dedicated server (e.g. MediaTemple)

tl;dr: pros/cons with Google AppEngine, and which hosting method is
your preferred method?

[1]: http://code.google.com/appengine/articles/django.html
[2]: http://mediatemple.net/webhosting/dv/
[3]: http://www.webfaction.com/

-- 
With regards, Herman Schistad

-- 
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@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.



Re: url problems

2011-07-04 Thread Herman Schistad
> the current url (path) is C:\Users\Dagon\mysite. Everything is relative to
> mysite.

Make sure you read the guide once more, and that you have "runserver"
up and running (issue the command: python manage.py runserver"
Then you go to the following URL: localhost:8000/polls and you will
hopefully get another result.

-- 
With regards, Herman Schistad

-- 
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@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.



Re: How to use the django-users mailing list properly and doing your homework..

2011-07-01 Thread Herman Schistad
Yeah, I forgot that dpaste deleted after 7 days, but pastebin is a
good proposal Brian.

We could also recommend people to paste the code in both pastebin and
email, as the probability of someone taking the time to read through
the code then becomes higher (I know I would much rather click on a
pastebin link and read the code there - which makes it more probable
that I'll help)

-- 
With regards, Herman Schistad

-- 
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@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.



Re: How to use the django-users mailing list properly and doing your homework..

2011-07-01 Thread Herman Schistad
What about including something about e.g. http://dpaste.com for snippets etc.
I know I hate to read more than 10 lines of code in my email reader,
without syntax highlighting or correct indentation.

-- 
With regards, Herman Schistad

-- 
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@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.



Re: giving download links

2011-06-28 Thread Herman Schistad
On Tue, Jun 28, 2011 at 05:20, raj <nano.ri...@gmail.com> wrote:
> I allow a user to upload a file, how do I now allow them to download
> this file? I looked at the "serving static files" thing in the
> djangoproject, but they said it causes security flaws or something.
> Can someone help me? I couldn't find good information on google. Thank
> you.

What do you mean, you just give them the link to the file they just uploaded.
Download here
Here you can use whatever template tools you have available.

Serving static files are just for debugging and to be used with
manage.py runserver, due to, as you said, security and scaling.
You should look into mod_python, mod_wsgi, fastcgi or some other
application, in order to serve your media files.

Take a look at the documentation or the djangobook:
https://docs.djangoproject.com/en/dev/howto/deployment/
http://www.djangobook.com/en/beta/chapter21/

Or am I missing something?

-- 
With regards, Herman Schistad

-- 
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@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.



Re: Split up .po files for Internationalization

2011-06-24 Thread Herman Schistad
On Fri, Jun 24, 2011 at 17:06, Stuart MacKay
<smac...@flagstonesoftware.com> wrote:
> A possible step would be to split the files then simply concatenate them
> together, using a custom management command, before calling compilemessages.
> That would make it easier to manage the translations but at the cost of an
> extra step in preparing for deployment.

It would though, in my opinion, be a good feature to maybe specify
which files to compile with compilemessages such that this feature was
built into django.
E.g.

$ ls
forms.po models.po translators.po
$ django-admin.py compilemessages translators.po models.po
$ ls
forms.po models.po translators.po django.mo

Or something. I'm not a django developer, but I'm sure someone here
is, and this may have been a ticket sometime? :)

-- 
With regards, Herman Schistad

-- 
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@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.



Re: FileField model question

2011-06-23 Thread Herman Schistad
On Thu, Jun 23, 2011 at 18:51, raj <nano.ri...@gmail.com> wrote:
> I was reading https://docs.djangoproject.com/en/1.3/topics/http/file-uploads/,
> and I got a little confused when looking at the handle_uploaded_file
> function.

You should read:
https://docs.djangoproject.com/en/dev/ref/models/fields/#filefield

And a simple google search on "handle uploaded file django" gives this
useful snippet:
http://djangosnippets.org/snippets/1036/

Did you search google before asking? :-)

-- 
With regards, Herman Schistad

-- 
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@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.



Re: Automatic internal link middleware

2011-06-22 Thread Herman Schistad
On Wed, Jun 22, 2011 at 15:24, Cal Leeming [Simplicity Media Ltd]
<cal.leem...@simplicitymedialtd.co.uk> wrote:
> We have actually just implemented this on one of our other sites still in
> development. The problem with keyword highlighting is you have to be careful
> not to enter into infinite loops, by ensuring you only match keywords
> outside of existing HTML tags. Normally I'd just say "figure it out for
> yourself", but this particular task took me about 4-5 hours to figure out,
> and was eventually solved by someone elses regex on google, so it's only
> fair I share :)
> Here is the code we have used (works 100% of the time so far) - this is
> quickly modified cut and paste, so you may need to tinker with it to make it
> work.

Thanks Cal. Real nice of you to share. As Tim also mentioned, the
solution is simple, but I figured there had to be some caveats with
the regex.
I'm really interested in your new project and would definitively watch
your webcast (ref. your other topic)

Again, thanks. Have a nice day.

-- 
With Regards, Herman Schistad

-- 
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@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.



Automatic internal link middleware

2011-06-22 Thread Herman Schistad
Hi there fellow developers.

I'm wondering if anyone has seen an app which does the following:
* Finds keywords in the templates, which is defined by the user and
then creates internal links to these.

Use-case:
1. I create keyword: "Cupcakes" and give it the href/URL property:
/info/cupcakes/ in adminpanel
2. I write a flatpage/template where I mention the word cupcakes
3. Middleware notices this word and renders a http://groups.google.com/group/django-users?hl=en.



Re: updating a user form?

2011-06-22 Thread Herman Schistad
On Wed, Jun 22, 2011 at 10:14, raj <nano.ri...@gmail.com> wrote:
> If I didn't have the url
> set up in this manner, how would I manage to extract the userprofile?

If you have the "AuthenticationMiddleware" activated you would use request.user
This returns a User object, which you then can use to further edit things.

E.g.
user = request.user
user.username = "Somethingnew"
user.save()

Or, as Kevin Renskers said, you would create a seperate model for the
userprofile if you wanted to extend it. Here you will need to get the
user profile with user.get_profile() and remember to set the
following: AUTH_PROFILE_MODULE = "myapp.mysiteprofile"

Then you could use the above example like this:
user = request.user
user.get_profile().homepage = "http://example.org;
user.save()

-- 
With regards, Herman Schistad

-- 
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@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.



Re: updating a user form?

2011-06-22 Thread Herman Schistad
On Wed, Jun 22, 2011 at 08:28, raj <nano.ri...@gmail.com> wrote:
> I'm trying to create an update_profile form. This form will be able to
> update extended user information that is not in the original form.
>
> So, I have a form that allows you to create an account. There a lot of
> other fields that aren't listed in this form. The rest of these fields
> will be found when the user actually logs in. What I can't figure out
> is how to make the class that allows them to update this information.
> Like in the extended user class that I made, I have a save function
> that creates a user and saves it. But I don't want to create another
> user with this form. I simply want to update the current authenticated
> user. I thought there would be an update_user type function in the
> UserManager(), but there isn't. I tried googling and didn't come up
> with much. Help Please?

I don't quite understand what you mean...

When you say load the url: /userprofile/1234/ at got your urls.py to
get  from the URL.
Then you could load that userprofile from the db with e.g.

def a_nice_view(request, id):
from django.auth.models import User
userprofile = User.objects.get(pk=id)
## Then do updating on that profile here ##
userprofile.username = "Somethingnew"

It's the same way with a form/request, and you can get the userprofile
with: request.user

All this is pretty basic stuff, and as I've seen you ask a lot of
these questions on django-users I would really advise you to read a
introductory book or do some more tutorials before trying to make
something advanced yourselves.

-- 
With regards, Herman Schistad

-- 
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@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.



Re: django problem

2011-06-20 Thread Herman Schistad
On Mon, Jun 20, 2011 at 12:21, jaspreet kaur <kj5...@gmail.com> wrote:
> please tell me how to place mytemplates folder in template path of django
> means what is the meaning of template path of django

Please Jaspreet, this is clearly stated in the documentation and I see
no need to spam the django-users email list.
Templates are discussed in great length here [1] and here [2]
The most common structures are:
[*] A template folder in your project directory containing templates
to all your apps.
[*] A template folder in all of your apps containing the apps templates.
See the settings.py and more specifically the template loaders and
paths setting. If you get an error page saying it cannot find your
template, then you have the ability to see which directories it in
fact are trying.

Read the documentation if there are any further questions, the Django
docs are great and all your questions should be answered there. If
they are not, see if the same question are asked by someone else at
stackoverflow[3] or in the mailing list before[4]

[1]: https://docs.djangoproject.com/en/dev/topics/templates/
[2]: 
https://docs.djangoproject.com/en/dev/intro/tutorial03/#use-the-template-system
[3]: http://stackoverflow.com/
[4]: https://groups.google.com/forum/#!forum/django-users
-- 
Regards, Herman Schistad

-- 
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@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.



Dumping a db using django db api

2007-02-14 Thread Herman

Well I made a little script that dump the database content insert
statements of a django application, useful for creating the initial
data of an application. I don't know if this has been done or if it's
a feature of the many tools that django provides, but it have fun
making it.

#!/usr/bin/env python
import sys,os

if len(sys.argv) != 2:
print 'Usage:\n\tpython %s [app_name]\n' % sys.argv[0]
sys.exit(-1)

def setup_django_app():
sys.path.append(os.getcwd())
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'


def dbize(value):
if value is None:
return 'NULL'
return("'" + str(value).replace("'","\\'") + "'")


def dump_app_db(app_name):
from django.db import models
__import__(app_name + '.models', {}, {}, [app_name])
for model in models.Model.__subclasses__():
table = model._meta.db_table
columns = [field.column for field in
model._meta.fields]
for object in model.objects.all():
values = [object.__dict__[column] for column
in columns]

csv_columns = ",".join(columns)
csv_values = ",".join([dbize(value) for value
in values])
print "INSERT INTO %s(%s) VALUES (%s);" %
(table,csv_columns,csv_values)



if __name__ == '__main__':
if len(sys.argv) != 2:
print 'Usage: \n\tpython %s [app_name]\n' %
sys.argv[0]
sys.exit(-1)
app_name = sys.argv[1]
setup_django_app()
dump_app_db(app_name)


--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---