Re: Database Modeling Help - Relating Instance Fields to Instance Fields
I figured it out, I think. If I create an intermediary table like this: class PatchConnection(models.Model): connection = models.ForeignKey(Connection) content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) object_id = models.PositiveIntegerField() content_object = GenericForeignKey('content_type', 'object_id') Then the PatchPoint model fields would be ForeignKey relations to PatchConnections. I guess writing out the question helped me to figure it out. Thanks, On Sunday, March 13, 2016 at 9:41:08 PM UTC-4, MattDale wrote: > > I'm working on an A/V Cable and Equipment management project and have run > into an issue. The application is functioning as designed, but I'd like to > add another feature that keeps track of connections between equipment and > cables. Since the app is working as is, I'd like to fit this feature in > the current schema. > > Here's a really basic models.py that I wrote to describe the problem. > (This is untested, I wrote this in order to ask the question in detail) > class Connection(models.Model): > name = models.CharField(max_length=50) > gender = models.CharField(max_length=20) > > class Manufacturer(models.Model): > name = models.CharField(max_length=200) > # other fields describing the mfg location etc. > > class Equipment(models.Model): > """ > components in a rack or a speaker or a microphone; anything > that is connected with cables > """ > name = models.CharField(max_length=100) > manufacturer = models.ForeignKey(Manufacturer) > # other fields describing the equipment type, etc. > > class EquipmentConnection(models.Model): > """ > this represents any connection on a piece of equipment > there can be many connections per parentEquipment > """ > parentEquipment = models.ForeignKey(Equipment) > connection = models.ForeignKey(Connection) > labelText = models.CharField(max_length=20) > # other fields here relevant to labels > > class Cable(models.Model): > """ > This connects to equipment connections, OR connects to each other for > extending > OR connects to a BreakoutPair > """ > name = models.CharField(max_length=100) > origin_connection = models.ForeignKey(Connection, > related_name="origin_connection") > destination_connection = models.ForeignKey(Connection, > related_name="destination_connection") > > class CableBreakout(models.Model): > """ > Some cables have "breakouts" or "tails" that are made up of > multiple channels. > Think of it like the 1/8" iPod cable that breaks out to the Red and > White > RCA connectors. > The two RCA connectors would be the breakout. This comparison is kinda > crappy. > > Suffice it to say that this model needs to exist for the next model, > BreakoutPair. > """ > name = models.CharField(max_length=100) > cable = models.ForeignKey(Cable) > whichEndOfTheCable = models.CharField(max_length=20) # just to keep > track of which side of the cable this breakout is on and to prevent > duplicates > > class BreakoutPair(models.Model): > """ > there can be many of these related to each Cable Breakout > """ > breakout = models.ForeignKey(CableBreakout) > channel = models.CharField(max_length=20) > labelText = models.CharField(max_length=40) > connection = models.ForeignKey(Connection) > > > class PatchPoint(models.Model): > """ > here's the question... > I need to keep track of patch points. > A patch point consists of two connections, A and B > It represents the connection point between two items. > For example, plugging in an HDMI cable to a TV would be represented > with this. > The HDMI cable connector is pointA and the HDMI port on the TV is > pointB > > The problem is that each connection can be any of the following: > - Cable.origin_connection, Cable.destination_connection > - BreakoutPair.connection > - EquipmentConnection.connection > > I would like to have this as a database table so that I can check for > errors > such as "This cable connection is already patched into Equipment > Connection X." > and create reports detailing what connections are patched > """ > pointA = ''# ? genericForeignKey? GenericForeignKey would only relate > to a Cable, Breakout
Database Modeling Help - Relating Instance Fields to Instance Fields
I'm working on an A/V Cable and Equipment management project and have run into an issue. The application is functioning as designed, but I'd like to add another feature that keeps track of connections between equipment and cables. Since the app is working as is, I'd like to fit this feature in the current schema. Here's a really basic models.py that I wrote to describe the problem. (This is untested, I wrote this in order to ask the question in detail) class Connection(models.Model): name = models.CharField(max_length=50) gender = models.CharField(max_length=20) class Manufacturer(models.Model): name = models.CharField(max_length=200) # other fields describing the mfg location etc. class Equipment(models.Model): """ components in a rack or a speaker or a microphone; anything that is connected with cables """ name = models.CharField(max_length=100) manufacturer = models.ForeignKey(Manufacturer) # other fields describing the equipment type, etc. class EquipmentConnection(models.Model): """ this represents any connection on a piece of equipment there can be many connections per parentEquipment """ parentEquipment = models.ForeignKey(Equipment) connection = models.ForeignKey(Connection) labelText = models.CharField(max_length=20) # other fields here relevant to labels class Cable(models.Model): """ This connects to equipment connections, OR connects to each other for extending OR connects to a BreakoutPair """ name = models.CharField(max_length=100) origin_connection = models.ForeignKey(Connection, related_name="origin_connection") destination_connection = models.ForeignKey(Connection, related_name="destination_connection") class CableBreakout(models.Model): """ Some cables have "breakouts" or "tails" that are made up of multiple channels. Think of it like the 1/8" iPod cable that breaks out to the Red and White RCA connectors. The two RCA connectors would be the breakout. This comparison is kinda crappy. Suffice it to say that this model needs to exist for the next model, BreakoutPair. """ name = models.CharField(max_length=100) cable = models.ForeignKey(Cable) whichEndOfTheCable = models.CharField(max_length=20) # just to keep track of which side of the cable this breakout is on and to prevent duplicates class BreakoutPair(models.Model): """ there can be many of these related to each Cable Breakout """ breakout = models.ForeignKey(CableBreakout) channel = models.CharField(max_length=20) labelText = models.CharField(max_length=40) connection = models.ForeignKey(Connection) class PatchPoint(models.Model): """ here's the question... I need to keep track of patch points. A patch point consists of two connections, A and B It represents the connection point between two items. For example, plugging in an HDMI cable to a TV would be represented with this. The HDMI cable connector is pointA and the HDMI port on the TV is pointB The problem is that each connection can be any of the following: - Cable.origin_connection, Cable.destination_connection - BreakoutPair.connection - EquipmentConnection.connection I would like to have this as a database table so that I can check for errors such as "This cable connection is already patched into Equipment Connection X." and create reports detailing what connections are patched """ pointA = ''# ? genericForeignKey? GenericForeignKey would only relate to a Cable, BreakoutPair, or EquipmentConnection instance\ # not a Cable, BreakoutPair or EquipmentConnection field pointB = ''# ? # am I thinking about this wrong? Is there a better way of handling this? The problem comes with the PatchPoint model. I can't devise a way to do this... Is there a way to structure the database so that this relationship can work? Would another database type help here, like Redis or something? Normally, writing out the question leads me to a direction, but I'm stuck this time. Thanks for any advice, -Matt -- 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/1ea00112-c83c-46cf-9907-d58606a604e3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: looking for an apache/system admin master
Thanks for the reply. I had no idea things like munin or graphite existed. Graphite looks really interesting. I'm honestly worried because I feel that since I'm new to setting up Apache servers that I can make a mistake that may be detrimental to my company's network and information. Our system is monitored by an external IT company, so that puts me slightly more at ease, but I still don't feel too comfortable about my current config. I added the two suspect IP addresses to exclude in the virtual host definition. This is more of an Apache config issue, so I won't continue it on the list but if there is anyone in the NYC area that would be willing to help for this one-off config, we can discuss rates etc off list. Thanks again for the reply On Tuesday, June 18, 2013 6:26:06 PM UTC-4, jjmutumi wrote: > > If they are requesting urls that do not exist why are you worried? Just > block that IP address in the > vhost configuration and continuously monitor the server for strange or > unexpected traffic. > > You can look into something like munin or graphite. > > > On Tue, Jun 18, 2013 at 8:26 PM, MattDale > > wrote: > >> I've been using windows/django1.4/apache2.2 for a couple intranet apps >> and it has been working well. I recently had our admin open up a port in >> our firewall to deploy another app publicly. We weren't using the app and >> there were issues when testing, since both the admin and myself are newbies >> to deploying publicly with Apache with SSL. So we left the server as is and >> tested UX for this app on an external host. We installed a new system wide >> firewall last week which the admin thought would help with our issues so I >> went to do some server prep today to bring the app on an internal server >> again. >> >> A check of the access logs found a specific external IP address hitting >> the server every 1/4 second with strange URLs that look to be commonly used >> php urls since June 7,2013. It has been getting hit for DAYs and I just >> wasn't monitoring the server. Each of the requests either 302'd or 404'd >> and there are thousands of them. I stopped the server, and sent an email >> to the admin to close that port down. >> >> Since neither I nor the system admin know much about deploying, is there >> anywhere I can look to hire someone to help get this app deployed safely? >> Our policies require SSL and we are willing to use other OS or servers, >> we just need someone who knows what they are doing. >> >> We are in the NYC vicinity. >> >> Thanks, >> >> -- >> 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...@googlegroups.com . >> To post to this group, send email to django...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/django-users. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- 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 http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
looking for an apache/system admin master
I've been using windows/django1.4/apache2.2 for a couple intranet apps and it has been working well. I recently had our admin open up a port in our firewall to deploy another app publicly. We weren't using the app and there were issues when testing, since both the admin and myself are newbies to deploying publicly with Apache with SSL. So we left the server as is and tested UX for this app on an external host. We installed a new system wide firewall last week which the admin thought would help with our issues so I went to do some server prep today to bring the app on an internal server again. A check of the access logs found a specific external IP address hitting the server every 1/4 second with strange URLs that look to be commonly used php urls since June 7,2013. It has been getting hit for DAYs and I just wasn't monitoring the server. Each of the requests either 302'd or 404'd and there are thousands of them. I stopped the server, and sent an email to the admin to close that port down. Since neither I nor the system admin know much about deploying, is there anywhere I can look to hire someone to help get this app deployed safely? Our policies require SSL and we are willing to use other OS or servers, we just need someone who knows what they are doing. We are in the NYC vicinity. Thanks, -- 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 http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Complex(for me) queryset comparisons
Thank you so much! The CSI field is the way to go I think. It definite gets me thinking in a new direction, rather than trying to mess with Django querysets, just design the model to give me the information I want! -- 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 http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problem with csrf
I'm not sure it absolutely needs fixing. There may be times that you don't need to use an HttpRequest but may need csrf protection in a view. Maybe? I don't know, but at least maybe under step 3.1 they should make the first word RequestContext a link to https://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-context-requestcontext for people working off the docs like you did. On Wednesday, June 12, 2013 9:03:55 PM UTC-4, Nick Dokos wrote: > > MattDale > writes: > > > You are correct in assuming that your first view using > > render_to_response shouldn't work without sending a RequestContext in. > > > A much cleaner way is just to use the render function. > > https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render > > which takes a lot of typing out of the typical render_to_response with > > RequestContext. > > > > OK - thanks! I tried the render() approach and it works fine. I'll be > using that one. > > There is still the question of whether the doc needs fixing. I take it > you are saying that it does? > -- > Nick > > -- 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 http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Complex(for me) queryset comparisons
I am having an issue coming up with a way to analyze data that I've been collecting. I would rather not change my model definition at this point, but I am open to suggestions. A Bundle is a group of audio/video/AC cables that are taped together in our warehouse to our client's specification. We build hundreds of these per month and would like to analyze the most common Bundles that we create to increase efficiency. Here is my model definition: class Bundle(models.Model): name = models.CharField(max_length=50) length = models.CharField(max_length=50, choices=LENGTH) created = models.DateField(auto_now=True) archived = models.BooleanField(default=False) class Cable(models.Model): cable_type = models.CharField(max_length=50, choices=CABLE_TYPES) origin_cable_connector = models.CharField( max_length=50, choices=CONNECTORS, verbose_name='Taped End') destination_cable_connector = models.CharField( max_length=50, choices=CONNECTORS, verbose_name='Non-taped End') bundle = models.ForeignKey('Bundle') Some examples for the constants: CABLE_TYPES: powercon, 19pr, XLR CONNECTORS: powercon(blue), powercon(grey), G3(male), G3(female), XLR(Male), XLR(Female), LENGTH: 25ft, 150ft, 200ft If I wanted to know the number of times a similar Bundle is created, I wanted to use something like: repeated_sets = {} all_cable_sets = [list(sorted(b.cable_set.all())) for b in Bundle.objects.all()] for set in all_cable_sets: occurences = all_cable_sets.count(set) print occurences if occurences > 1: if set not in repeated_sets: repeated_sets[set] = occurences This doesn't work because each set belongs to a different bundle, so they are all unique and occurences never goes greater than 1. I would also like to know the lengths of these similar Bundles and the number of times identical bundles were created where the cable_sets are all the same and their parent Bundle's length is the same. I figured I should attempt the simpler query first without the length, and add length later by iterating through the repeated_sets dictionary and querying for each cable_set's parent Bundle and generating a new dictionary out of that. Should I be approaching this from a different angle? Is there a nice Django way of making these comparisons and counts? Thank you, -Matt -- 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 http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Point System in django
A quick google didn't turn up any packages for your specific case, but you may not want to use a pre-built solution. Amirouche wanted some more information about how you plan on implementing the project. Here's a simple concept: It seems that you would want to customize the standard User model and add an integer field "Points" to it with default value=0. When the User purchases these fictitious points, you would increment their associated Points value by whatever they paid for. Then when the User is on the site and logged in, you can use Javascript to send an asynchronous request to the server when the Play button is pressed on the page. Since the user is logged in, it's instance is available in the context that was sent through in the AJAX request. You would then be able to subtract the corresponding point value from that User's Points field. Obviously my description has flaws: you need to be careful with the Javascript so the User doesn't click the Play button multiple times, you need to set rules in the User model to not allow negative Point values, not allow the user to press the Play the button if they don't have enough Points, etc. On Wednesday, June 12, 2013 1:38:45 PM UTC-4, coded kid wrote: > > How do you mean? Please explain further. > > On Monday, 10 June 2013 14:05:56 UTC+1, Amirouche wrote: >> >> >> >> Le lundi 10 juin 2013 12:59:05 UTC+2, coded kid a écrit : >>> >>> what is the best way to implement this? Users will pay a certain fee >>> and get some amount of points (100points) and for every video the user >>> watch, like 30points will be deducted. How can I go about this? is >>> there a package for point system in django? >>> >> >> This is simple transaction scheme what is specific to your usecase ? >> > -- 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 http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problem with csrf
You are correct in assuming that your first view using render_to_response shouldn't work without sending a RequestContext in. A much cleaner way is just to use the render function. https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render which takes a lot of typing out of the typical render_to_response with RequestContext. On Wednesday, June 12, 2013 8:23:40 PM UTC-4, Nick Dokos wrote: > > I have a simple application and it DTRT before turning on CSRF > (this is on Django 1.5.1). So I tried to follow the documentation > to turn on CSRF detection and was getting intro trouble. > > First I tried to follow this page: > >https://docs.djangoproject.com/en/1.5/ref/contrib/csrf/ > > I did steps 1 and 2 (uncommenting the csrf middleware in > MIDDLEWARE_CLASSES and adding {% csrf_token %} to my (one and only) > POST form) and then tried step 3.2: > > --8<---cut here---start->8--- > from django.core.context_processors import csrf > from django.shortcuts import render_to_response > > def my_view(request): > c = {} > c.update(csrf(request)) > # ... view code here > return render_to_response("a_template.html", c) > --8<---cut here---end--->8--- > > where I added my dictionary entries to c before passing it to > render_to_response. > > That did not work - the development server said: > > , > | > /usr/local/lib/python2.7/dist-packages/django/template/defaulttags.py:58: > | UserWarning: A {% csrf_token %} was used in a template, but the context > | did not provide the value. This is usually caused by not using > | RequestContext. > | > | warnings.warn("A {% csrf_token %} was used in a template, but the > | context did not provide the value. This is usually caused by not > | using RequestContext.") > ` > > I tried step 3.2, instead of step 3.1, because the page above did not > contain enough detail for me to figure out how to use RequestContext and > I was too lazy to type it into the search box: I was suitably punished > for my laziness. > > I finally found a different page that described how to use RequestContext: > > > https://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-context-requestcontext > > > with the following code fragment: > > --8<---cut here---start->8--- > from django.shortcuts import render_to_response > from django.template import RequestContext > > def some_view(request): > # ... > return render_to_response('my_template.html', > my_data_dictionary, > context_instance=RequestContext(request)) > --8<---cut here---end--->8--- > > I adapted it for my purposes and things are working fine. > > The question is: is the first method supposed to work? If so, what am > I doing wrong? If not, it should be taken out of the documentation. > > Also, can a link be added in the first page to get to the second page > easily? > > Thanks! > -- > Nick > > > > -- 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 http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Controlling GPIO on rasPi, need help with Refreshing switch status without reloading page via jquery
I think you are on the right track with the jquery setup for handling the submission of the form. What you need to implement here is an AJAX form. I would do something like this, although I don't necessarily know what I'm doing: $(document).ready(function () { var form = $("#gpio_form") var button = $("#{{pin1.PinID}}") form.submit(function(e) { e.preventDefault() $.get("url that points to your AJAX view/", form.serialize(), function(message){ if (message == 'true'){ button.attr('value', '1') } // end if message is true if (message == 'false'){ button.attr('value', '0') }// end if message is false });// end get call });// end form submit });// end doc ready So instead of your current view, I would use a dedicated URL and view that handles the AJAX GET request. GET vs. POST request conventions aside, for the point of instruction, $.get is easier to use, but is not semantically correct. The view that handles the button value change would look like something like this: def button_check(request): try: #something that checks the GET for button status if request.GET['button'] == 1: result = True else: result = False except: result = False message = json.dumps({'result':result}) return HttpResponse(message, mimetype="application/json") Sorry for the garbage code, but hopefully this will help describe how to make an AJAX form and get you most of the way there. If you want to contact me off list, I am willing to help since I'm interested in Django on the RaspberryPi Thanks, On Monday, February 4, 2013 11:15:19 PM UTC-5, 7equiv...@gmail.com wrote: > > I also have a javascript file, but I'm not quite sure what to out in > it.. > > function gpio_submit(){ > $("#gpio_results").load("/control_page"); > return false; > } > > $(document).ready(function () { > $("#gpio_form").submit(gpio_submit); > }); > > On Monday, February 4, 2013 11:12:27 PM UTC-5, 7equiv...@gmail.com wrote: >> >> I'm controlling the GPIO pins on a raspberryPi that is running a Django >> web app. I have a form with only one button that is "On" or "off", it >> writes this to a database. The Button's value has to display the current >> status "On" or"off". >> So I need to be able to update the value of the button in the form, >> without reloading the entire page. >> >> I have jquery, so I'm trying to figure out how to use it in conjunction >> with the Django View to get this done. Here is my View.py and >> control_page.html >> >> I am a novice in Programming so don't be afraid to dumb it down >> >> @login_required >> def control_page(request): >> if request.method == 'POST': >> pin1 = Pin.objects.get(pinID=1) >> >> if 'pin1Status' in request.POST: >> if pin1.pinStatus == 'hi': >> pin1.pinStatus = 'low' >> else: >> pin1.pinStatus = 'hi' >> pin1.save() >> >> variables = RequestContext(request, {'pin1': pin1}) >> return render_to_response('control_page.html', variables) >> else: >> pin1 = Pin.objects.get(pinID=1) >> variables = RequestContext(request, {'pin1': pin1}) >> return render_to_response('control_page.html', variables) >> >> >> >> >> {% extends "base.html" %} >> {% block external %} >> >> >> >> {% endblock %} >> {% block title %}Control Panel{% endblock %} >> {% block head %} >> >> {% endblock %} >> {% block content %} >> >> >> >> {% csrf_token %} >> {{ pin1.pinDescription}} {{ pin1.pinDirection}} >> >> >> >> >> http://192.168.137.96:8081"; scrolling="no" width="275" >> height="220" frameboarder="0"> >> iframes are not supported by your browser. >> >> >> {% endblock %} >> > -- 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 http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Editable Tables
I used this tutorial to get me going with the dhtmlx grid. http://www.rkblog.rk.edu.pl/w/p/using-dhtmlxgrid-django-application/ it's easy once you get the hang of it to make custom grids for each view, but not as cut and dry as it seems you are looking for. On Wednesday, September 5, 2012 4:27:39 AM UTC-4, Sait Maraşlıoğlu wrote: > > This is an example how to create and modify admin listing page: This > explains better > > class BookAdmin(admin.ModelAdmin): > list_display = ('title', 'publisher', 'publication_date') > list_filter = ('publication_date',) > date_hierarchy = 'publication_date' > ordering = ('-publication_date',) > filter_horizontal = ('authors',) > *raw_id_fields = ('publisher',) > > Lets say , I want to use this kind of command for my frond-end, django handle > the search fields and listing parameters. > only with my own table model, lets say its DHTMLX . at the end, I will have > my view, generated with search options and > a few buttons to search,view,edit... > is it possible, not required to be ready to use, I just looking for a way to > achieve it. > > thx again. > * > > > > > On Sunday, 2 September 2012 00:58:25 UTC+3, Sait Maraşlıoğlu wrote: >> >> Just seen a demo page >> http://nextgensim.info/grids >> so beautiful grids, >> lift framework can do that, I guess, havent dig much but as far as I >> seen, its an alternative framework. >> Can anybody tell me how to create this kind of interactive tables? What >> django has to offer, if not What keywords, I need to search? >> thx >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/13Gt-IywCh0J. 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: Editable Tables
Try DHTMLX Grid. I use it solely for the editable grid feature. It took a little while to style it so it fits with my site, but as far as simple AJAX editable grids, I couldn't find an better one. On Saturday, September 1, 2012 5:58:25 PM UTC-4, Sait Maraşlıoğlu wrote: > > Just seen a demo page > http://nextgensim.info/grids > so beautiful grids, > lift framework can do that, I guess, havent dig much but as far as I seen, > its an alternative framework. > Can anybody tell me how to create this kind of interactive tables? What > django has to offer, if not What keywords, I need to search? > thx > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/T-kwZS0sC80J. 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: New to Django, having difficulty creating first app. PLEASE HELP!
Glad you are trying out Django. That error is telling you what's wrong The directory that you are in does not include the file "manage.py". Depending on your operating system, when you get this error, get the contents of the directory(windows, type dir and press enter) if the outputted list doesn't include "manage.py", then you are not in the outer mysite directory. You most likely did not "change into the outer mysite directory". So from that point in the tutorial, type cd .. and press enter, and that should be the outer directory. just to be sure, check the contents of the directory you are in by typing "dir". Sorry if that answer is a little too basic and you already know all that, but I wanted to offer the simplest troubleshooting options first. Good luck On Friday, August 24, 2012 7:10:21 PM UTC-4, lukedc wrote: > > > Hello everyone, > > I am doing the django tutorial. > https://docs.djangoproject.com/en/1.4/intro/tutorial01/ > > I am on the part where it says, "The development server". It says: Let's > verify this worked. Change into the outer mysite directory, if you > haven't already, and run the command python manage.py runserver. > > When I type in "python manage.py runserver" on the command prompt, > however, it says, "python: can't open file 'manage.py': [Errno 2] no such > file or directory. > > What should I do? Can you please tell me? > > I have done everything right so far. > > Thank you all so much, Luke > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/dvhYfNcXeiMJ. 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.
RES: Django-tables2
If you make that column a regular Column does it render properly? If not then confirm that you define the column exactly as it is spelled in your models.py(case and all). Once it renders properly as a regular Column, then try changing to a LinkColumn. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/kGHFiQpIuDYJ. 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-tables2
Here's an example of one of my tables. class NeedsTable(tables.Table): needQuantity = tables.Column() prod_id = tables.Column() description = tables.LinkColumn('needsdetail', args=[A('pk')]) department = tables.Column() order = tables.Column() priority = tables.Column(accessor='order.event.priority') show = tables.Column(accessor='order.event.name') preppedQuantity = tables.Column() prepdate = tables.Column() class Meta: order_by = 'priority' attrs = {'class': 'general_table'} URLS.py - url(r'^qcarea/needs/detail/(?P\d+)/$', 'needs.views.needsdetail', name='needsdetail') LinkColumn uses reverse() to get its view and you use the Accessor(A) to pass the pk to the args of the reverse call. This means that you must name your URL in your urls.py. In your example, I can't quite figure out what you are attempting with the TemplateColumn. To me it seems like you need to create two link columns. Good Luck On Thursday, August 23, 2012 1:28:01 PM UTC-4, Robert wrote: > > Hi All, > > > > I would like to ask something, I´m trying to render a table > using *Django-tables2 *and that table has a link column that I want to > link with another page, I cant figure out how can I link my model, and pass > my PK to url.py. Here’s My code: > > > > > > *## Models.py: ##* > > > > > > class Projetos(models.Model): > > > > #FIELDS > > nome_projeto = models.CharField("Projeto", max_length=150, > null='true',) > > desc_oferta = models.CharField("Descrição da oferta", max_length=500, > null='true',) #aumentar > > integrador = models.CharField("Integrador", max_length=150, > null='true',) > > contend_provider = models.CharField("Contend Provider", > max_length=150, null='true',) > > marca_servico = models.CharField("Marca do Serviço", max_length=150, > null='true',) > > valor_retry = models.IntegerField("Valor de retry", null='true',) > > la = models.IntegerField("Large account", null='true',) > > lanc_comercial = models.DateField("Lançamento comercial", null='true') > > term_projeto = models.DateField("Término do projeto", null='true') > > data_acordo = models.DateField("Data de Acordo", null='true') > > data_revisao = models.DateField("Data de Revisão", null='true') > > ura_id = models.IntegerField("URA ID", null='true') > > ura_desc = models.CharField("Descição URA",max_length=150, null='true') > > > > ** > > *## tables.py ##* > > ** > > > > TEMPLATE = ''' > > > >Edit > > > > upload > > > > ''' > > > > > > class ProjetosMain(tables.Table): > > > > pdb.set_trace() > > nome_projeto = > tables.Column(verbose_name='Projeto',orderable=False) > > integrador = > tables.Column(verbose_name='Integrador',orderable=False) > > contend_provider = tables.Column(verbose_name='CP',orderable=False) > > status = tables.Column(verbose_name='Status',orderable=False) > > term_projeto = > tables.Column(verbose_name='Vigencia',orderable=False) > > > > Acoes = tables.TemplateColumn(TEMPLATE) > > > > class Meta: > > attrs = {'class': 'bordered'} > > *#* > > *## url.py ##* > > *#* > > > > urlpatterns = patterns('', > > > > # Main Page portal > > (r'^$', portal_main_page), > > > > # Home Page > > (r'home/$', portal_main_page), > > > > # Project Page > > url(r'projetos/$', projetos_main_page), > > url(r'projetos/?P\d{1,2,3,4}/edit/', project_edit, > name="project_edit"), > > url(r'projetos/?P\d{1,2,3,4}/docs/', project_docs, > name="project_docs"), > > > > # Upload File > > (r'^uploadfile/$', uploadfile), > > (r'^uploadsuccess/$', uploadsuccess), > > > > ) > > > > > > Best Regards / Muito Obrigado, > > -- > > Roberto Ferreira Junior > > robefe...@gmail.com > > 11 98009942 > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/vm2VIX0jZOAJ. 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-tables2
It is just a very easy way to create html tables with one simple template tag that have features like sorting by column, easy, quick css etc. without using javascript at all. There are times when this is easier than creating a table and customizing it. I use it for general tables that don't need any ajax features. Although I've lately been creating manual tables and using the "tablesorter.js" to handle quick sorting. On Friday, August 24, 2012 1:58:03 AM UTC-4, Alex Strickland wrote: > > On 2012/08/24 01:49 AM, MattDale wrote: > > > I love django-tables2! > > May I ask why? I'm not trolling, I'd like to know more about it. > > -- > Regards > Alex > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/OvDvrRqhel0J. 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-tables2
Your answer is LinkColumn instead of TemplateColumn. You can pass Args and kwargs with this in your table. I'll post an example of this when I get home. It's quite simple. I love django-tables2! -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/viAnr_W9aK8J. 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.