Search Results

Search found 5330 results on 214 pages for 'django auth'.

Page 131/214 | < Previous Page | 127 128 129 130 131 132 133 134 135 136 137 138  | Next Page >

  • Building a user subscription application

    - by Tristan O'Neil
    Hello, I'm trying to come up with the best way to handle user subscription and management for our magazine website. What I want to happen is a user purchases a subscription and they are granted online access of a certain membership role for a certain amount of time depending on how many years they subscribed for. I would also like the system to be able to send out emails when a subscription is almost up. I've seen some third party projects to help accomplish this but I'd prefer to write this from scratch as I want total control over how it works. Any suggestions would be helpful. The main thing I can't figure out is how to have an expiring membership. You must keep track of when the user signed up and how long until they should expire.

    Read the article

  • Tools and tips for switching CMS

    - by Jimmy
    I work for a university, and in the past year we finally broke away from our static HTML site of several thousand pages and moved to a Drupal site. This obviously entails massive amounts of data entry. What if you're already using a CMS and are switching to another one that better suits your needs? How do you minimize the mountain of data entry during such a huge change? Are there tools built for this, or some best practices one should follow?

    Read the article

  • Tallying records using annotate() not working as should.

    - by 47
    I have two classes: Vehicle and Issues....a Vehicle object can have several issues recorded in the Issues class. What I want to do is to have a list of all issues, with each vehicle appearing only once and the total number of issues shown, plus other details....clicking on the record will then take the user to another page with all those issues for a selected vehicle shown in detail now. I tried this out using annotate, but I could only access the count and vehicle foreign key, but none of the other fields in the Vehicle class. class Issues(models.Model): vehicle = models.ForeignKey(Vehicle) description = models.CharField('Issue Description', max_length=30,) type = models.CharField(max_length=10, default='Other') status = models.CharField(max_length=12, default='Pending') priority = models.IntegerField(default='8', editable=False) date_time_added = models.DateTimeField(default=datetime.today, editable=False) last_updated = models.DateTimeField(default=datetime.today, editable=False) def __unicode__(self): return self.description The code I was using to annotate is: issues = Issues.objects.all().values('vehicle').annotate(count=Count('id')) What could be the problem?

    Read the article

  • Problem with validating ModelForm

    - by user561640
    I use ModelForm to create my form. All works fine except 1 thing - validating the unique field. Code: class Article(models.Model): ... title = models.CharField(max_length=255, unique=True, error_messages={'max_length' : 'max translation', 'unique' : 'unique translation', 'required' : 'req translation',}) ... class ArticleForm(ModelForm): ... title = forms.CharField(max_length=255, min_length=3, error_messages={'required' : 'req translation', 'min_length' : 'min translation', 'max_length' : 'max translation', 'unique' : 'unique translation',}) But when I save my form with non-unique title I don't get my custom translated error but I get default error. How to fix it, that my unique field error is displayed?

    Read the article

  • How can I measure distance with tastypie and geodjango?

    - by Twitch
    Using Tastypie and GeoDjango, I'm trying to return results of buildings located within 1 mile of a point. The TastyPie documentation states that distance lookups are not yet supported, but I am finding examples of people getting it work, such as this discussion and this discussion on StackOverflow, but no working code examples that can be applied. The idea that I am trying to work with is if I append a GET command to the end of a URL, then nearby locations are returned, for example: http://website.com/api/?format=json&building_point__distance_lte=[{"type": "Point", "coordinates": [153.09537, -27.52618]},{"type": "D", "m" : 1}] But when I try that, all I get back is: {"error": "Invalid resource lookup data provided (mismatched type)."} I've been pouring over the Tastypie document for days now and just can't figure out how to implement this. I'd provide more examples, but I know they'd be all terrible. All advice is appreciated, thank you!

    Read the article

  • Python: UTF-8 problems (again...)

    - by blahblah
    I have a database which is synchronized against an external web source twice a day. This web source contains a bunch of entries, which have names and some extra information about these names. Some of these names are silly and I want to rename them when inserting them into my own database. To rename these silly names, I have a standard dictionary as such: RENAME_TABLE = { "Wsird" : "Weird", ... } As you can see, this is where UTF-8 comes into play. This is the function which performs renaming of all the problematic entries: def rename_all_entries(): all_keys = RENAME_TABLE.keys() entries = Entry.objects.filter(name__in=all_keys) for entry in entries: entry.name = RENAME_TABLE[entry.name] entry.save() So it tries to find the old name in RENAME_TABLE and renames the entry if found. However, I get a KeyError exception when using RENAME_TABLE[entry.name]. Now I'm lost, what do I do? I have... # -*- coding: utf-8 -*- ...in the top of the Python file.

    Read the article

  • Edit form not being instanciated

    - by 47
    I have two models like this: class OptionsAndFeatures(models.Model): options = models.TextField(blank=True, null=True) entertainment = models.TextField(blank=True, null=True) seats_trim = models.TextField(blank=True, null=True) convenience = models.TextField(blank=True, null=True) body_exterior = models.TextField(blank=True, null=True) lighting = models.TextField(blank=True, null=True) safety = models.TextField(blank=True, null=True) powertrain = models.TextField(blank=True, null=True) suspension_handling = models.TextField(blank=True, null=True) specs_dimensions = models.TextField(blank=True, null=True) offroad_capability = models.TextField(blank=True, null=True) class Vehicle(models.Model): ... options_and_features = models.ForeignKey(OptionsAndFeatures, blank=True, null=True) I have a model form for the OptionsAndFeaturesclass that I'm using in both the add and edit views. In the add view it works just fine. But the edit view renders the OptionsAndFeatures as blank. The code for the edit view is as follows: def edit_vehicle(request, stock_number=None): vehicle = get_object_or_404(Vehicle, stock_number=stock_number) if request.method == 'POST': # save info else: vehicle_form = VehicleForm(instance=vehicle) photos = PhotosFormSet(instance=vehicle) options = OptionsForm(instance=vehicle) #render_to_reponse What could be the problem here?

    Read the article

  • Update single field

    - by 47
    I have a Customer class which has a representative field....this field is initially blank but when the user opens up the details page of the chosen customer, they'll be given the open of representing this customer by clicking on a link. The template layout I was thinking of is this: <strong>Representative: </strong> {% if customer.representative %} {{ customer.representative }} {% else %} <a href="{% url representCustomer customer.id %}">Represent this customer.</a> {% endif %} All that remains is the view to effect this...this is where I'm stuck.

    Read the article

  • Count Records in Listing View

    - by 47
    I have these two models: class CommonVehicle(models.Model): year = models.ForeignKey(Year) series = models.ForeignKey(Series) engine = models.ForeignKey(Engine) body_style = models.ForeignKey(BodyStyle) ... class Vehicle(models.Model): objects = VehicleManager() stock_number = models.CharField(max_length=6, blank=False) vin = models.CharField(max_length=17, blank=False) common_vehicle = models.ForeignKey(CommonVehicle) .... What I want to do is to have a count of how many times a given CommonVehicle object is used in the Vehicle class. So far my attempts are giving me one number, which is a total of all the records. How can I have the count being the total appearances for each CommonVehicle

    Read the article

  • How to display two QuerySets in one table?

    - by Mark
    I have two different QuerySets which both return a list of Users (with different fields). How can I display them both in one HTML table? One Query will always be a subset of the other; I just want to fill in the missing data with 0s. How can I do this?

    Read the article

  • Username already exists, when wanting to update userprofile in djago

    - by Ajirapsy
    Whenever i try try to update a userprofile on djano powered web, i get the error, username already exists, please provide another one. I am trying to get it to recognize the authenticated user. ALthough every other thing works, but it would not update until i specify a new username. views.py @login_required def editprofile(request): registeredmember = request.user.get_profile() if request.method == 'POST': userprofile_edit = RegistrationForm(request.POST, instance = registeredmember) if userprofile_edit.is_valid(): userprofile_edit.save() return HttpResponseRedirect('/profile/') else: userprofile_edit = RegistrationForm(instance = registeredmember) return render_to_response('carloan/editprofile.html', {'userprofile_edit': userprofile_edit}, context_instance=RequestContext(request))

    Read the article

  • smartif tag not working out correctly

    - by 47
    I'm using the smartif tag from this snippet (I'm holding on with regards to upgrading to 1.2) in my template for a certain boolean field like so: {% if payment.extends_membership == "True" %} {% trans "Yes" %} {% else %} {% trans "No" %} {% endif %} But whatever the value of extends_membership I get only No as the output. What could be the problem?

    Read the article

  • Some tables mixed together

    - by DJPython
    Hello. I have 2 different tables in my database. They have some variables common and some different. For example: Table1: ID Date Name Address Fax Table2: ID Date Name e-mail Telephone number I want to display data together sorted by date & ID but from both tables. For example, first displayed will be the newest record from first table, but the second one will be the record from another table posted right after first one. Hope everybody understand, sorry for my English. Cheers.

    Read the article

< Previous Page | 127 128 129 130 131 132 133 134 135 136 137 138  | Next Page >