Application design question

2009-01-31 Thread eddie

Hey guys & girls,

I've just started playing with django, and am not sure of the best way
to do something.

I've got a basic site, where page a displays model a, page b displays
model b, etc.  Every model has it's own view function and template,
all extending a base template with a header, footer, etc.  In every
page's footer, I would like to add a parsed RSS feed (just an ul of
links).

I don't want to repeat code, so I don't feel like calculating it and
sending it to every render_to_response that I've got (I'll worry about
caching later, by the way).  So I wonder if there is a way that I
could give every template access to this object without adding it to
my views... though this seems like a kind of "global variable" type
situation that I'm a little wary of too.

How would you proceed?

Thanks!
-e
--~--~-~--~~~---~--~~
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: Application design question

2009-02-01 Thread eddie

Thanks Alex, that was exactly what I was looking for.

On Jan 31, 8:06 pm, "alex.gay...@gmail.com" 
wrote:
> On Jan 31, 8:04 pm, eddie  wrote:
>
>
>
> > Hey guys & girls,
>
> > I've just started playing with django, and am not sure of the best way
> > to do something.
>
> > I've got a basic site, where page a displays model a, page b displays
> > model b, etc.  Every model has it's own view function and template,
> > all extending a base template with a header, footer, etc.  In every
> > page's footer, I would like to add a parsed RSS feed (just an ul of
> > links).
>
> > I don't want to repeat code, so I don't feel like calculating it and
> > sending it to every render_to_response that I've got (I'll worry about
> > caching later, by the way).  So I wonder if there is a way that I
> > could give every template access to this object without adding it to
> > my views... though this seems like a kind of "global variable" type
> > situation that I'm a little wary of too.
>
> > How would you proceed?
>
> > Thanks!
> > -e
>
> Take a look at implementing a template context processor.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Question about flatpages + registration required

2011-07-22 Thread eddie
Sorry for the question, but I can't seem to track down a place to
start.

I've got a fairly simple django site that includes flatpages.  I'm
trying to require authentication to view one or two of the flatpages
(like I would with a .htaccess, for instance).  When I go to the
admin, and click the "registration required" checkbox and go to the
flatpage url, I'm still able to access the page when logged out.  I've
included django.contrib.auth and django.contrib.contenttypes as
installed apps, as well.

Can someone let me know what I'm missing here? Is there something more
that I have to do to enable authentication for these pages?

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



Many-to-many or a better way/read-only admin after creation.

2010-03-06 Thread eddie
Hi everyone, I've got few questions that my experience can't answer...
I'm not sure the best way to proceed.

I'm piggy-backing using the admin interface as a sort-of glorified
spreadsheet (accessible to everyone).  I've created a model that
contains information about drivers licenses.  Name, address, license
#, state, birthday, etc.  No problems there.

I also want to track dates that I've last seen these people.  So if
they come in first on Jan 01, next on Feb 02, and last week on March
03, I can look at a list of those dates.  My first thought was to
create a new model that just stores dates, and create a many-to-many
relationship between users and dates, but since that date model would
contain just that... a date, it seems a little strange to me. Is there
a better way that I'm not thinking of?

The second question is more about the admin interface.  Once a user's
license info has been taken, there's no reason to change it again...
only the date that I've last seen them.  Is there a way to make some
of the user info read-only after creation (maybe based on user
permissions)?  That would prevent people from accidentily changing
anything but the last_seen date.

Thanks to everyone for any help!!!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



how to? : non-required admin fields

2008-06-29 Thread eddie

Hi.  I'm looking to find out how you make form fields in the admin
section non-required.  I've done a few hours of searching, but haven't
found the answer yet.  If anyone can let me know where I can find it,
it would be much appreciated.

Thanks!
-e

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: how to? : non-required admin fields

2008-06-29 Thread eddie

Thanks Jeff.

On Jun 29, 10:41 pm, Jeff Anderson <[EMAIL PROTECTED]> wrote:
> eddie wrote:
> > Hi.  I'm looking to find out how you make form fields in the admin
> > section non-required.  I've done a few hours of searching, but haven't
> > found the answer yet.  If anyone can let me know where I can find it,
> > it would be much appreciated.
>
> Put blank=True and null=True in your models.py for the field in question.
>
>  signature.asc
> 1KDownload
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Trying to understand project structure w/apps

2008-07-08 Thread eddie

Hi guys+gals,

I'm new to django, and I'm trying to wrap my head around a project
structure.  I have a simple case that I'm thinking about, but can't
put together a reasonable mental model for it.

I've got a site that has a schedule component (events), and a news
component (news items).  So I can easily create two apps, one for
events, and the other for news, and I can create varying ways to
display these components.  My problem is that when I start thinking
about the homepage... where I'd like to display both some events, and
some news items.  I can't figure out how I would use templates to do
such a thing... place both on the same page.  Ideally, I would like to
have a template that displays an event, and one that displays a news
item.  But I'm not sure how that would work, with both of them
extending the same base template.

I could, of course, create one app which has all of these models
internal, which would let me easily pull them into a single template,
but I would really rather not couple the two distinct models together
in both the view and the templates.

If someone could give me a few pointers in a direction they'd approach
this problem, it would be greatly appreciated.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: manage.py command not found

2011-03-30 Thread Eddie Sullivan
If you're talking about the line that imports your app, that usually
means you have an error in your application code (the views or the
models). Try starting the shell and run "import x" manually and
see what errors you get.
-Eddie

On Mar 30, 11:57 am, "jay K."  wrote:
> hi, Shawn
>
> I finally managed to get python manage.py shell to work, by commenting
> out those INSTALLED_APPS that had an issue with 'import x'
>
> it turns out that 'import x' was the problem.
>
> do you have any suggestions to fix 'import x'?
>
> thanks
>
> On Wed, Mar 30, 2011 at 12:25 PM, jay K. wrote:
>
>
>
> > Hello, Shawn
>
> > I type python manage.py shell in my project directory and get the following
> > error
>
> > Error: No module named xx
>
> > regards
>
> > On Wed, Mar 30, 2011 at 11:52 AM, Shawn Milochik wrote:
>
> >> Check the permissions on manage.py. I'm guessing it's not executable.
>
> >> Either use chmod +x on manage.py or execute it with Python: python
> >> manage.py.
>
> >> --
> >> 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.

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



Django Tutorial

2020-03-19 Thread Eddie Nash
I am going through the tutorial yet when I check to see if it is working, I 
get this error code. Please help me fix this!


Exception in thread django-main-thread:
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", 
line 932, in _bootstra
p_inner
self.run()
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", 
line 870, in run
self._target(*self._args, **self._kwargs)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/utils/autoreload
.py", line 53, in wrapper
fn(*args, **kwargs)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/management/
commands/runserver.py", line 117, in inner_run

self.check(display_num_errors=True)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/management/
base.py", line 392, in check
all_issues = self._run_checks(
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/management/
base.py", line 382, in _run_checks
return checks.run_checks(**kwargs)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/checks/regi
stry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/checks/urls
.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/checks/urls
.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/utils/functional
.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/urls/resolvers.p
y", line 588, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/utils/functional
.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/urls/resolvers.p
y", line 581, in urlconf_module
return import_module(self.urlconf_name)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py",
 
line 127, in
import_module
return _bootstrap._gcd_import(name[level:], package, level)

  File "", line 1014, in _gcd_import
  File "", line 991, in _find_and_load
  File "", line 975, in _find_and_load_unlocked
  File "", line 671, in _load_unlocked
  File "", line 783, in exec_module
  File "", line 219, in 
_call_with_frames_removed
  File "/Users/michellenash/Desktop/Eddie/github/mysite/mysite/urls.py", 
line 20, in 
path('polls/', include('polls.urls')),
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/urls/conf.py",
 
l
ine 34, in include
urlconf_module = import_module(urlconf_module)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py",
 
line 127, in
import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1014, in _gcd_import
  File "", line 991, in _find_and_load
  File "", line 975, in _find_and_load_unlocked
  File "", line 671, in _load_unlocked
File "", line 779, in exec_module
  File "", line 916, in get_code
  File "", line 846, in source_to_code
  File "", line 219, in 
_call_with_frames_removed
  File "/Users/michellenash/Desktop/Eddie/github/mysite/polls/urls.py", 
line 6
path('', views.index, name'index')
  ^
SyntaxError: invalid syntax

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fcf08b9d-587f-4fab-a79c-b0325845b036%40googlegroups.com.