I typically create a second file which stores my sensitive data and import
it as a variable.
Then can exclude say.. credentials.py when sharing code.
I don't know that this is an ideal solution, just something that I've taken
as habit.
On Friday, November 30, 2018 at 11:51:44 AM UTC-6,
I've done this recently by importing smtplib into my views.py file, and
made executing a mail send a result of a view.
I didn't realize at the time, but there is Django specific tools for this
as well.
https://docs.djangoproject.com/en/2.1/topics/email/
On Monday, November 19, 2018 at
Hey,
Traceback:
==
ERROR: test_event_view (cal.tests.EventsTestCase)
--
Traceback (most recent call last):
File
Hey all,
Can anyone tell me the (probably quite obvious) reason my reverse match
isn't working?
Template:
Url:
url(r'^events/(\d+)/delete_event$', views.delete_event,
name='delete_event'),
View:
def delete_event(request, id):
Events.objects.filter(id=id).delete()
return
in return_dict:
return_dict[event.start_date.day].append(event)
else:
return_dict[event.start_date.day] = [event]
return return_dict
On Thursday, April 20, 2017 at 4:35:36 PM UTC+1, Will Holmes wrote:
>
> Hi guys,
>
>
> I
Hi guys,
I am using django to develop a calendar web app where users can create events
that are then displayed on a month by month view.
I have written a custom template tag that takes Python's HTMLCalendar
formatmonth function and overlays events that are on that day.
It is currently
Oh yeah i see.
Brilliant sorted it! Thanks for your help Melvyn.
--
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
I am making a calendar app which has a custom template tag that takes the
python HTML template function and overlays objects from the Events model on
the correct days. I am trying to get the displayed objects to have a link
directly to an object detail/edit view and am trying to use
/1150
On Tue, Nov 4, 2014 at 4:54 PM, Justin Myles Holmes
<twotonespi...@gmail.com> wrote:
> Carl:
>
> Actually, the "subclass the operation" method fails for obvious reasons
> here:
>
> https://github.com/django/django/blob/df0523debcc2d0984f1bc11d323f04227d4
ezzanine's migration is the simplest
solution. I sense that I'm going to face some resistance if I suggest
changing their docs to reflect this. I'll start with a blog post.
On 11/04/2014 04:30 PM, Justin Myles Holmes wrote:
> Well, as I say, I don't particularly like this field injection noti
ng models in your
> project, you're not going to be able to use anything makemigrations
> outputs and expect it to Just Work™.
>
> Andrew
>
> On Tuesday, November 4, 2014 3:59:23 PM UTC-8, Carl Meyer wrote:
>
> Hi Justin,
>
> On 11/04/2014 04:42 PM, Justin
urpose and document how to import and use it in a
migration?
Well, the problem there is that Operation isn't used directly, but
subclassed for each individual type of migration operation.
On 11/04/2014 03:33 PM, Carl Meyer wrote:
> Hi Justin,
>
> On 11/04/2014 04:17 PM, Justin Myl
urpose and document how to import and use
it in a migration?
On 11/04/2014 03:33 PM, Carl Meyer wrote:
> Hi Justin,
>
> On 11/04/2014 04:17 PM, Justin Myles Holmes wrote:
>> Hey Carl. Missed you so very much at DjangoCon. :-)
> Thanks :-)
>
>>> I'm no
11/01/2014 04:35 PM, jMyles Holmes wrote:
>> Using Django 1.7, how can the user perform a migration operation (say,
>> AddField) on an app other than the app in which the migration lives?
>>
>> Here's the use case:
>>
>> Mezzanine lets you inject fields
Hey friends!
Using Django 1.7, how can the user perform a migration operation (say,
AddField) on an app other than the app in which the migration lives?
Here's the use case:
Mezzanine lets you inject fields on its own stock models using the
EXTRA_MODEL_FIELDS setting.
However, as the Mezzanine
t;
> On Wed, Apr 2, 2014 at 12:04 PM, Justin Holmes <jus...@justinholmes.com>wrote:
>
>> No no, the annotate doesn't work - that's the whole reason for my
>> question. See, the annotate doesn't associate instances with the annotated
>> attribute, it associated results.
fixed, your original
> annotate might work.
>
>
> On Tue, Apr 1, 2014 at 6:20 PM, Justin Holmes <jus...@justinholmes.com>wrote:
>
>> You say "use the reverse relation manager in LlamaHerd to build up your
>> annotation," but that answer the question.
>>
You say "use the reverse relation manager in LlamaHerd to build up your
annotation," but that answer the question.
How can I sort LlamaHerd objects by the DOB of their largest llama?
On Tue, Apr 1, 2014 at 6:13 PM, Justin Holmes <jus...@justinholmes.com>wrote:
> Yes, abso
Tue, Apr 1, 2014 at 6:09 PM, Bill Freeman <ke1g...@gmail.com> wrote:
> Aren't you missing a ForeignKey relationship to tell which LlamaHerd a
> Llama belongs to?
>
> Then you would use the reverse relation manager in LlamaHerd to build up
> your annotation.
>
>
> On Tu
might be able to use annotate:
LlamaHerd.annotate(largest_llama=Max('llama__size')).order_by('largest_llama__dob')
...but the annotate here creates fields with float values, not with the
model instances.
--
Justin Holmes
Chief Chocobo Breeder, slashRoot
slashRoot: Coffee House and Tech Dojo
New
ary at all, as the Http404 page makes it clear
that it's an exception.
On Wed, Mar 28, 2012 at 7:22 PM, Russell Keith-Magee
<russ...@keith-magee.com> wrote:
>
>
> On 29/03/2012, at 12:10 AM, Justin Holmes wrote:
>
> > Russell,
> >
> > Thanks for the reply.
> >
that I simply hadn't raised Http404 since implementing this
middleware. It makes perfect sense that it behaves the way it does.
On Tue, Mar 27, 2012 at 11:29 PM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:
>
> On 28/03/2012, at 6:31 AM, Justin Holmes wrote:
>
> &
Heretofore, I had always believed that Http404 did not cause Middleware
process_exception() to be run. Am I right in this thinking?
I have a get_object_or_404 that, when the object in question isn't found,
is running process_exception.
--
Justin Holmes
Head Instructor, SlashRoot Collective
quot; group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com <django-users%2bunsubscr...@googlegroups.com>.
> For more options, visit this group at http://groups.g
n this direction.
http://groups.google.com/group/django-deeper
--
Justin Holmes
Head Instructor, SlashRoot Collective
SlashRoot: Coffee House and Tech Dojo
60 Main Street
New Paltz, NY 12561
845.633.8330
--
You received this message because you are subscribed to the Google Groups
"Django users" g
specified in the TEMPLATE_DIRS setting.
The same code is executed just fine in production.
--
Justin Holmes
Head Instructor, SlashRoot Collective
SlashRoot: Coffee House and Tech Dojo
60 Main Street
New Paltz, NY 12561
845.633.8330
--
You received this message because you are subscribed to
I am having a problem with contrib.sessions.tests.test_valid_key (line
159). It's a mixin which in the failure case is mixed with
CacheDBSessionTests.
The test raises:
"AttributeError: 'bool' object has no attribute 'get'"
The error is actually raised by session.save() on 164.
Stepping inward
On Sep 20, 12:07 am, Micke wrote:
> Thank you for your quick reply!
>
> My socket server is ready, but I dont know where to import it in
> django so it starts when django starts?
You are going to run your socket server in a different python process
than Django.
How you use a virtualenv in production depends on all the parts of
your production stack. If you are using mod_wsgi, search mod_wsgi +
virtualenv, gunicorn, etc
You might also consider one of the new "platform-as-a-service" hosting
options that basically solve this for you.
-P
On Sep 19, 10:55
I've just pushed an initial release of a tool that will hopefully make
it easier to make apps more easily shareable.
The idea is something like this:
manage.py startapp gets you a start, but once you get something to the
point where you might want to share it, now you've got to wrap it up
in all
This is a cart/horse pattern I run now and then, and while I can think
of several sort of ugly ways to do it, I'm wondering if someone has a
clean solution in Django.
I'm going to use a gradebook as an example. The goal is to present a
user with a grid of lets say students and assignments to
I'm pretty comfortable with the concept of mixing multiple objects in
one form. But I have a case where I have a model formset and want to
add a form field that represents a field from a related model, such
that the related model can be created if it is filled out.
As a simple example:
I have a
On Sep 19, 1:50 pm, "J. P. Smyth"
wrote:
> Someone here wrote:
>
> "Mutli-column composite keys are not currently supported by Django.
> Adding support for multi-column keys (primary or otherwise) is
> something that has been long discussed, and there is
On Friday, September 17, 2010, Stodge wrote:
> I have a bunch of models and I want to specify which models (tables)
> are stored on which PostgreSQL database. I've read the documentation
> and I know I can use the using() function. I'm just wondering this
> can't be specified in
On Sep 10, 2:43 pm, Christos Jonathan Hayward
wrote:
> P.S. Setting:
>
> .filter(is_invisible__in = [False, None])
how about:
.exclude(is_invisible__exact = True)
>
> is not working as intended; I seem to be getting no matches when I should be
> getting
On Sep 9, 5:11 am, justin jools wrote:
> Hi Muhuk,
>
> I am using django-simple-friends app, much easier to setup than django-
> friends.
> but need a little help and was hoping for some guidance.
>
> I have set up friends_list.html no problem:
> Friend List
> Friends
On Sep 8, 5:04 am, Dave wrote:
> Hi everyone,
>
> I've found in documentation usage of custom file storage. There it is
> like that
> (http://docs.djangoproject.com/en/1.2/topics/files/#the-built-in-files...
> ) -
>
> from django.db import models
> from
On Sep 8, 11:47 pm, Max_ wrote:
> Hello,
> I created a website, using the IPN-Function.
> Everything worked fine at first - the notification view was called and
> the signal was sent.
> But now (without any changes on the code), the IPN-Request from PayPAL
> doesn't call the
On Sep 7, 1:45 am, Benedict Verheyen
wrote:
> Hi,
>
> i've written a calltracking application for my company and other apps will
> follow soon.
> Now, i would want a central way to access them and to assign rights on who
> can see
> and run what application.
> The
On Sep 6, 2:39 am, kmpm wrote:
> First of all to everyone, thanks for all good suggestions so far.
>
> Regarding UUIDs, one of the business requirements (which I don't
> control) is that the identifier that is to be used on barcodes and
> what not is to be in the format
On Aug 31, 4:31 am, Shamail Tayyab wrote:
> Hi,
>
> I am working on a chat application in Django, how can I ensure that I
> do not have to poll the server for any chat data.
>
> Possible approaches that I've been to:
>
> 1. BAD - use polling.
>
> 2. Use long polling -
Filemaker has a pattern where you can set the choices of a field to be
the indexed contents of that field.
Along with an "Other..." choice option to add a new value.
This is a very handy way of having user modified choices for a given
field.
Now I can think of several ways to do this in a form
Has anyone adapted the interfaced used for adding permissions to a
group/user to allow one to add users to a group?
How reusable is the CSS/JS?
-Preston
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
On Apr 26, 2:28 am, Kevin Renskers wrote:
> I also used the multiple select field found
> onhttp://www.djangosnippets.org/snippets/1200/
> with success, until I updated Django to the 1.2 beta release. It now
> longer works, always giving the validation error. I have no clue
On Mar 23, 8:20 am, jrs wrote:
> Is there a flag somewhere which will allow me to disable django
> messaging?
>
> Thanks
You give too few details. The messaging system is something that is
opt in, you have to create messages, and then display them in your
template. Are
On Mar 15, 10:27 pm, pyleaf wrote:
> I want to use manage.py as a command in script file.
> e.g,
>
> >> python manage.py shell
> >>from testproject.testapp.models import Testee
> >>from testproject.others.modules import utils
> >>utils.do(Testee)
>
> Above are commands in
On Mar 16, 3:21 am, ALJ wrote:
> This is a bit of a modeling question that I am struggling to get my
> head around. How would you model this scenario?
>
> I have to record expenses that are of 3 different types.
>
> 1. Fixed - The name of the expense and unit amount
On Feb 28, 12:21 pm, Simon Davies wrote:
> figured out how to do it using the get_form method like this:
>
> class AccessoryStockOrderAdmin(admin.ModelAdmin):
> form = AccessoryStockOrderForm
> def get_form(self, request, obj=None, **kwargs):
> form =
On Feb 17, 9:36 am, justind wrote:
> I have an unusual Django application. I was wondering if someone could
> offer advice to the best way to handle a requirement. This isn't a
> standard application (and might not even seem like a good use of
> Django, but that's
On Feb 9, 3:43 am, djangonoob wrote:
> Hello,
>
> I have the following problem which I hope someone could shed some
> light on.
>
> In my project I have the main site with login. I now implemented a
> questionnaire app that also requires a login. It would be great if
>
Assuming you want to create a score per class - you should have
students go to a form that:
creates a student and first score if student does not already exist
creates a score for the student for that class and date
Basically the students should be creating the 'blank' scores when they
come in.
On Dec 15, 12:02 pm, Continuation wrote:
> This is a question about django-uni-form. But I figure many people
> here may have experienced with django-uni-form so I'd try asking here.
>
> I'm using django-uni-form to style my form using the filter my_form|
> as_uni_form:
I've hit a case where I want to use aggregation, but I think I'll have
to end up using a for loop.
I have items. They have an estimated cost and an actual cost
They may have one, the other, or both defined.
They are both DecimalFields
I can get the sum of the estimated cost with a simple
Well something wonky is going on.
>From my readthrough of the code, it *should* get called on empty
formsets:
is_valid calls total_form_count to get a loop count
total_form_count should be positive even if forms are blank
is_valid then accesses form.errors inside that loop
On Dec 11, 10:40 am, Kashif Azeem wrote:
> Thank you Shawn for the reply now i have another problem i.e. on executing
> some commands like 'vgs' or 'lvs' it didnt executed and the warning
> generated as "Running as a non-root user. Functionality may be unavailable".
> Any
On Dec 10, 8:41 am, Adonis wrote:
> Hi,
>
> I am trying to figure out the best way to do this.
> I have built a django application where users are members in projects.
> Thus, i need to assign users different permission sets that correspond
> to different projects. The
On Dec 10, 11:02 am, jul wrote:
> hi,
>
> when submitting my form using jQuery form plugin, the request received
> by the target view is different than that received when the form is
> submitted in the standard way (with no javascript), and my Django
> template does not render
On Dec 10, 9:05 am, cerberos wrote:
> I'm building a library system and have models Member, Loan and
> LoanItem (relationships as you'd expect), and an inline formset to
> enter a new loan (Loan and LoanItems).
>
> A member can borrow up to 6 books at a time, so my form
On Dec 11, 5:20 am, Aaron wrote:
> On Dec 10, 6:04 pm, aa56280 wrote:
>
> > if form.is_valid():
> > # do something and redirect
> > else:
> > render_to_response('foo.html', {'form' : form'})
>
> Would that leave the URL as displayed in the browser
Is there a way to make this the default at the project level?
I see a number of tricks out there for making it easier to do within
your own views, but I'm using an auth check in django-navbar, so I
need the full context on every page, and not all reusable apps I'm
using are passing the
On Dec 7, 8:56 am, Daniel Goertzen wrote:
> Thanks for the reply Bill. The problem I had with that approach is that
> after creating the product I have to worry about creating red and green
> ports. Likewise, upon deletion, I have to mop up the ports. Looking
>
Not simply. The design of the tag to drop smaller time frames the
further out you are.
The source is all there for you to copy and modify into your own
custom filter, but that may be more than you want to bother with...
-Preston
On Dec 4, 3:22 pm, Continuation wrote:
On Dec 3, 12:02 pm, Wayne Koorts wrote:
> >> > remember that an app can do a lot more than provide views.
>
> >> Explain this one to me. AFAICS, its just http request/response all the
> >> way down and this is basically done by getting a
>
> > An app can expose views,
On Dec 4, 6:43 pm, jwpeddle wrote:
> Not having any luck with this. Surely there's a simple example out
> there somewhere of view agnostic DRY form logic.
The old thread you point to still makes sense.
A redirect can only happen in response to a request
a request is
On Nov 29, 4:50 pm, Continuation wrote:
> In the doc (http://docs.djangoproject.com/en/dev/ref/models/options/
> #order-with-respect-to) it is mentioned that order_with_respect_to
> marks an object as "orderable" with respect to a given field.
>
> What exactly does
On Nov 28, 11:07 pm, Preston Holmes <pres...@ptone.com> wrote:
> My expectation was that it was possible to 'stream' a response back to
> a browser from a view, where that response is 'trickled' onto the
> browser page. I had done this a while back in cherrypy and it worke
My expectation was that it was possible to 'stream' a response back to
a browser from a view, where that response is 'trickled' onto the
browser page. I had done this a while back in cherrypy and it worked
as expected.
a super simple view demonstrates the issue. Instead of a series of
numbers
I'm a bit confused on a few points here. The upload_to field
attribute should be atomic to the imagefield - it doesn't rely on
related models.
your change_upload_to creates a new screenshot - but doesn't connect
it to the current WebProject instance. Is that what you are trying to
do?
s =
On Nov 24, 1:28 am, Elyrwen wrote:
> Hello,
>
> I' ve been recently interested in Djagno framework and I am at the
> point of choosing it as the framework for my project. My application
> will not use database, but will use webservices to get data and then
> process it.
On Nov 23, 8:51 am, Aizen wrote:
> Hi,
>
> I'd like to implement filtering for my app...currently, the filtering
> I have is stateless and so I can't add onto whatever value the user
> last selected. I've also implemented each filter separately, so I'd
> like to know how
Perhaps there is a more efficient way, but in my quick test, one can't
filter() a queryset based on __class__ of the model, but seems one can
manually filter it afterwords:
qs = Player.objects.all()
for i,obj in enumerate(qs):
if obj.__class__ != Player:
del(qs[i])
On Nov 22, 4:32
On Nov 22, 4:47 pm, Micah Vivion wrote:
> Greetings,
>
> I have a question on how to update an existing row in my database when one of
> the fields is my primary key. I am using ModelForm and Django-Piston - my
> main goal here is to have RESTful Post send to my
There are some details left out of how you want this to look.
The lower the level you try to make an object self protecting, the
trickier it's going to be.
The sweet spot I think here is a custom manager that adds a protect
filter, and perhaps a subclass of ModelForm if you need this in
forms.
http://docs.djangoproject.com/en/1.1/ref/settings/#login-url
There are going to be some other places you will have to be careful
running django on a path other than /
-Preston
On Nov 19, 7:11 am, Stodge wrote:
> I added the @login_required decorator to my view but it
Its not clear how you differentiate one measure as speed or another as
dir. Assuming only one has a link to another measure then you could
do something like:
results = Measurand.objects.exclude(entry__isnull=True).select_related
()
for speed in results:
speed_avg = speed.avg_value
On Nov 16, 8:31 am, Zeynel wrote:
> Thanks!
>
> I noticed that using
>
> class Lawyer(models.Model):
> ...
> ordering = ('last',)
>
> did not work.
>
> But this worked
>
> class Lawyer(models.Model):
> ...
> class Meta:
> ordering = ('last',)
>
>
do you have error templates defined?
http://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views
-Preston
On Nov 16, 12:55 pm, Alessandro Ronchi
wrote:
> If I put Debug = False in my django settings.py I receive an internal
> server error with
On Nov 13, 5:13 pm, Preston Holmes <pres...@ptone.com> wrote:
> if submission.status == "submitted" and submission.reviews.count > 0:
> submission.status = "pending review"
>
> Are there even simpler ways to do this that I haven't thought of?
ans
I'm setting up a conference website where a submission will have one
or more "reviews"
I've got the reviews set as inlines for submissions in the admin
The submission model has a "status" field that needs to go through
steps like "submitted" and "pending review"
What I'd like to do is when the
On Aug 26, 4:17 pm, thornomad wrote:
>
> Caveats: I would like to keep the original "synced" data in its own
> field and the "approved" data (as edited) in separate field. I
> imagine that the data first gets brought into the "edit" field, admin
> may make changes and
You should change:
admin.site.register(PageAdmin)
to:
admin.site.register(FlatPage, PageAdmin)
also I don't see where you are using a generic relation - so the class
for your inline should be admin.StackedInline not
generic.GenericStackedInline
-Preston
On Nov 11, 8:37 pm, neridaj
On Nov 11, 4:38 pm, "Richard E. Cooke" wrote:
> My client wants to use e-mail addresses for user names.
>
> the contrib.auth application does not have a restriction in its
> model. But the form code has put a regex on the field that disallows
> the ampersand (@).
fyi
Does your fixture result in a valid form?
if the form.is_valid() line doesn't pass, then you would get a 200
from the render to response...
-Preston
On Nov 11, 4:38 pm, Eesti Mate wrote:
> When I'm testing my form with assertRedirects I get the following error
>
Is the admin in your installed apps in settings.py?
http://docs.djangoproject.com/en/1.1/intro/tutorial02/#activate-the-admin-site
Add "django.contrib.admin" to your INSTALLED_APPS setting.
-Preston
On Nov 11, 5:19 pm, neridaj wrote:
> I'm working on a standalone app and
another option if you want to stay in just python and are on a POSIX
system is to use system file locking to ensure you don't get
concurrent calls to your updated function.
http://docs.python.org/library/fcntl.html#fcntl.lockf
-Preston
On Nov 9, 10:17 pm, Continuation
On Nov 9, 7:49 am, NMarcu wrote:
> Hello all,
>
> I have a list of all users. My head table is made with the fields
> from User class. So look like this:
>
> username first name last name
> superuser status
>
> I want to make this head table
On Oct 31, 8:44 am, shacker wrote:
> At the university where I work, there is a LOT of momentum behind
> Drupal. A large and active users group, and dozens of departmental
> sites running it. I've succeeded in building a few departmental sites
> with Django but still
On Oct 30, 12:00 pm, Bill Freeman wrote:
> Yet another option is to write a widget that subclasses the existing
> one, and adds
> disabled='disabled' to the dictionary that will be used to populate
> the attributes
> (usually the 'attrs' argument, I think, and you will have
On Oct 27, 9:07 pm, Jacob Fenwick wrote:
> Wow, big surprise that someone else is having shared hosting issues with
> dreamhost eh?
>
> I'm importing a library I installed in site-packages in a module in a django
> app. When I call this django project, it returns with
Well you've gotten farther than I have.
I can get passenger_wsgi working with hello world, and cherrypy
I can get those working with any combination of virtualenv etc
But with django I get the not too helpful Premature end of script
headers even with apache LogLevel set to debug.
-Preston
On Oct 25, 2:55 pm, Bojan Mihelac wrote:
> Hi all,
>
> given an many_to_one doctests with Reporter/Article models, the
> following example would fail with "IntegrityError:
> many_to_one_article.reporter_id may not be NULL":
>
> >>> r = Reporter(first_name='John',
I think a base class with subclasses is the best approach.
Define as much common behavior as possible, set up defaults for those
fields needed by your outbound API
How are you handling the branching lookup of what subclass to use?
You might name the subclasses in some way that they can be
The way I think of the value of the "through" table approach is when
you want to attach information to the relationship that does not
belong on either model.
I like a band/musician example.
A person can be a part of many bands
A band has many people
so here we have a classic M2M
But a person
It doesn't seem like it would be that hard to combine django-
extensions export_emails command with Mailmans sync_members script
inside a cron job or a URL triggered script.
Usage: /usr/share/mailman/bin/sync_members [options] -f file listname
-Preston
On Oct 23, 6:06 am, Julien Phalip
It may not be as pretty as a parseable param array, but what about
just having all your args in a single JSON string. Are your template
authors savvy enough?
-Preston
On Jan 20, 3:32 pm, Andrew Ingram wrote:
> I'm building a simple banner/promotion system for a site.
So just for completeness, here is the bit about avoiding the inner for
loop in this situation:
On Jan 17, 8:40 am, ptone wrote:
> matching_torrents = Torrent.objects.filter(name__icontains='x360')
> my_data = []
> for a_torrent in matching_torrents:
> info_objects =
96 matches
Mail list logo